You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David Sanders <ds...@chaincast.com> on 2001/01/24 06:29:38 UTC

Specify appender programmatically

How can an app set appender info at runtime?

For example, assume an app is started 3 times, e.g.,
- java MyApp -id 1
- java MyApp -id 2
- java MyApp -id 3

There should be three appenders.  If using FileAppenders, the files might be
named myapp_1.log, myapp_2.log, and myapp_3.log.  Since the unique ID passed
to each MyApp at runtime isn't known in advance, it's not feasible to have
multiple log4j properties files.

How can a program specify the (file) appender filenames at runtime?

Thank you.