Does "additivity" flag in log4j.properties work only with log4j or with Apache Commons Logging as we

G

Gianni Galore

In a java class I created a (simplified) logger as follows:

package aaa;
....
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class bbb {
.....
private final Log log = LogFactory.getLog(getClass());
// or
private final Log log = LogFactory.getLog("aaa.bbb");

log.info("hello");
}

In the log4j.properties I defined:

log4j.rootLogger=INFO, console, logfile
log4j.additivity.aaa.bbb=false
log4j.additivity.aaa=false
log4j.appender.aaa.bbb=org.apache.log4j.RollingFileAppender
log4j.appender.aaa.bbb=C:/logs/mylog.txt
......


Unfortunately the log output goes always to all appenders from RootLogger and not to the special logfile
for my particular module.

Why?

Does the additivity flag apply only to pure log4j Loggers rather than Apache Commons Logging?

Gianni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top