wood burning stoves 2.0*
The moose likes Java in General and the fly likes log4j on 2 jars on the same classloader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "log4j on 2 jars on the same classloader" Watch "log4j on 2 jars on the same classloader" New topic

log4j on 2 jars on the same classloader

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Hi folks
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?

Thank you!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

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 7 API documentation
Scala Notes - My blog about Scala
Devarsh Shah

Joined: Mar 02, 2012
Posts: 6

Can you please explain why two jars are required??
I agree. Here's the link: http://aspose.com/file-tools
subject: log4j on 2 jars on the same classloader
Similar Threads
Simple JPA application on TOMEE
Maven 2 to Maven 3 up-gradation: Issue on version attribute
packages and CLASSPATH
Step by steyp JNDI look up with jboss 7.1
uploading images and java