Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to write only to ONE of the defined FileAppenders in log4j.properties?

0 views
Skip to first unread message

Gianni Galore

unread,
Sep 7, 2010, 10:56:24 AM9/7/10
to
I have an ApplicationServer with deployed Java Beans.
There is only ONE log4j.properties file in the whole system and it is a requirement that
no additional "child" log4j.properties should be used e.g. in Beans/WebApps.

In the central log4j.properties file I defined an additional "private" logfile:


log4j.RootLogger=INFO, .......
...
log4j.appender.mylogfile1234=org.apache.log4j.RollingFileAppender
....


How can I access exactly this fileappender from my java source?

All log.info(..) output from MY java app should go to MY private logfile
but NOT to the other possibly defined logfiles in log4j.properties.
Conversely all log output from other beans should NOT go to my logfile.

How can I address my private logfile?

At first I though that:

private final Log log = Logfactory.getLog("mylogfile1234");

does the trick but it does not help.

Any other solution?

Gianni

0 new messages