File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Make it so: Java DB Connections & Transactions
this week in the
Java in General
log4j on 2 jars on the same classloader
Joined: Jul 31, 2003
Dec 18, 2012 12:39:04
We have 2 jars that are loaded on the same classloader,
I would like to properly initialize log4j (1.2.15) so it will write to different log location for each jar.
I renamed each log4j property file to the plugin name, but log is created with single line only
Once I use just one jar - The log is working ok,
What am I missing here?
InputStream log4jFileStream = CommonPlugin.class.getClassLoader().getResourceAsStream("jar1_log4j.properties"); Properties props = new Properties(); props.load(log4jFileStream); PropertyConfigurator.configure(props);
Jesper de Jong
Joined: Aug 16, 2005
Dec 19, 2012 01:12:50
Are the classes in the two JAR files in different packages? Then you can just configure your loggers and appenders in the Log4J configuration file differently for the classes in the two different packages. No need to do complicated tricks.
Java Beginners FAQ
JavaRanch SCJP FAQ
The Java Tutorial
Java SE 8 API documentation
Joined: Mar 02, 2012
Jan 08, 2013 05:41:54
Can you please explain why two jars are required??
I agree. Here's the link:
subject: log4j on 2 jars on the same classloader
packages and CLASSPATH
uploading images and java
Step by steyp JNDI look up with jboss 7.1
Maven 2 to Maven 3 up-gradation: Issue on version attribute
Simple JPA application on TOMEE
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015