This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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: 14195

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
Devarsh Shah

Joined: Mar 02, 2012
Posts: 6

Can you please explain why two jars are required??
GeeCON Prague 2014
subject: log4j on 2 jars on the same classloader