logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Glezen <pgle...@atdial.net>
Subject Re: separate log files ??
Date Mon, 03 Sep 2001 19:24:18 GMT
Eddie Post wrote:
> However, when application A logs in log file log_file_A and it connects to
> applicatoin B, it continues logging in log_file_B. This comes because
> application B initializes log4j with PropertyConfigurator.configure(config
> file) and appearantly it overrides the log4j properties of application A.


Sounds like a judicious use of categories could solve this.  If the set
of classes that make up application A and B are disjoint, then it is
trivial: use classname as category name and it doesn't matter what order
things are configured.  Set log_file_A for the app_A categories and
log_file_B for the app_B categories.

If you have utility classes used in both app_A and app_B, then you need
for the utility class to come up with a scheme (perhaps by using some
kind of context information) to uniquely name the category instance that
each utility class instance uses.

If you're calling static methods of utility classes, then you may be out
of luck.

- Paul
Beware of bugs in the above code.  I have
only proved it correct, not tried it.
-Don Knuth

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message