Hi All:

At work, we have an installer program that installs one of five log4j
configs depending on what the user selects in a UI. Each of these 5 configs
causes log events to end up in different kinds of SQL and NoSQL databases,
you pick one when you install. The installer does a brute force search and
replace in the log4j file to replace markers with things like database IP
addresses and port numbers. So far so simple and good.

The next iteration of the installer provides an additional choice to log to
a file or not, in addition of one of the 5 databases.

Option 1?
In order to avoid having 5x2 preset config files in the installer, I'd like
to add the file config to each of the existing 5 configurations and have
the file appender enabled or not based on a boolean flag that the installer
can implement as part of its search and replace. You'd end up with:

<AppenderRef ref="foo" enabled="true|false" />
<AppenderFoo enabled="true|false" />

If an appender is disabled it does not end up in the Log4j object tree at
all. It is like it never existed in the config file.

Option 2?
Add a second log4j2.xml, say log4j2-rollingfile.xml config file and have
Log4j combine it with the other log4j.xml on the class path. How?

Other options?

Thank you,
Gary

Reply via email to