I'm a little confused: do you want to create loggers on the fly, or 
appenders?

creating loggers on the fly: Logger  logger = Logger.getLogger("com.foo");

creating appenders on the fly: 30 seconds with google yielded 
http://robertmaldon.blogspot.com/2007/09/programmatically-configuring-log4j-and.html

Douglas E Wegscheid
Lead Technical Analyst, Whirlpool Corporation
(269)-923-5278

"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."





Chris <she...@yahoo.com> 
09/07/2010 04:42 PM
Please respond to
"Log4J Users List" <log4j-user@logging.apache.org>


To
log4j-user@logging.apache.org
cc

Subject
Dynamic logger configuration






How can I trap calls to Logger.getLogger() so I can configure each 
logger dynamically?

Our app operates on data in dynamically-created directories. Every time 
we see a new directory, we want to create a new logger to put the logs 
in a new subdirectory. This means that we need a new logger instance for 
each directory, which must have its own FileAppender with the 
appropriate subdirectory name.

The trouble is that I can't configure all of these directory names in 
advance in log4j.properties because I don't know what they will be.




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org


Reply via email to