File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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: 14114
    
  16

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
Greenhorn

Joined: Mar 02, 2012
Posts: 6

Can you please explain why two jars are required??
 
Consider Paul's rocket mass heater.
 
subject: log4j on 2 jars on the same classloader