On Jan 18, 2009, at 10:41 PM, Arindam wrote:
Hi, I am faced with a problem. I have multiple java-modules which
run as
daemons, and am configuring their log4j.xml configuration.
I would like the individual xml configuration files to pick up the
stdout /
email appenders from a core file, and have their own appenders along
with
them.
I was thinking of using Xlink to do such a linking, but it seems
Xlink is
not supported in log4j.
Is there a way to link appenders defined in another xml ? Except maybe
programmatically attach an appender ?
Thanks,
Arindam.
You can use external entities which the XML parser will resolve before
log4j see anything. For example:
<!DOCTYPE log4j:configuration [
<!ENTITY common SYSTEM "common.xml">
]>
<log4j:configuration>
<!-- common stuff -->
&common;
<!-- custom stuff -->
</log4j:configuration>
I believe earlier versions of log4j had problems with external
entities (either they didn't work at all or you had to use absolute
URL since the base URL was lost).
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]