Re: log4j, tomcat and multiple webapps



PeterH wrote:
Hi all,

I have a number of different webapps deployed which are all logging to the
same log file, depending on which one is started first and how the server
is feeling at the time.

The log4j.properties files start with a line of the format:

log4j.logger.<package>.<class>=DEBUG, R

In the matching classfile in the webapp, the logger is declared as:

private static Log log = LogFactory.getLog(<class>.class);


Where am I going wrong?

The typical thing to do with log4j in a web container is to supply each web application with its own log4j.jar. The class loading rules for web applications imply that each web application will get its own version of the log4j classes, and so then will not share the static configuration information.


HTH,
Ray

--
XML is the programmer's duct tape.
.



Relevant Pages

  • Re: log4j, tomcat and multiple webapps
    ... >> I have a number of different webapps deployed which are all logging to the ... >> same log file, depending on which one is started first and how the server ... The other possibility (to keep a single set of log4j classes shared among ...
    (comp.lang.java.programmer)
  • Re: Logging components?
    ... I think Logging is pretty much individual, so that usualy everyone has their ... {Write Logged exception into the Log file? ... {Write exception with a short string description into the Global App Log ... > By logging components, I specifically DON'T MEAN components for catching ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Phantom /var full messages
    ... if you could isolate it to just snort or just MySQL. ... without restarting the program that's logging to them. ... compresses the current log file into a new file, ...
    (freebsd-questions)
  • Re: Annoying 1202 errors
    ... Enabling this logging tracks all changes and settings applied to the machine ... Name: UserEnvDebugLevel ... I recommend that you remove any existing log file and then use gpupdate ... feature GUEST. ...
    (microsoft.public.win2000.group_policy)
  • Re: Theodore Adorno, a prophet of data systems design
    ... >> Can you translate the above into English please? ... > at compile time or runtime, up to you) what level of logging you wish. ... >> a single log file from multiple threads for anyone with even a beginner's ... > Actually, I can't guarantee that it will work in a multithreaded program, ...
    (comp.programming)