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

Discussion in 'Java' started by Gianni Galore, Sep 8, 2010.

  1. 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
    Gianni Galore, Sep 8, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    807
    Eddie McCreary
    Oct 24, 2003
  2. Replies:
    2
    Views:
    13,729
  3. Replies:
    1
    Views:
    2,119
    Irmen de Jong
    Jun 22, 2004
  4. www
    Replies:
    2
    Views:
    10,305
    bugbear
    Aug 22, 2007
  5. Facade

    log4j/commons-logging issue?

    Facade, Oct 1, 2008, in forum: Java
    Replies:
    3
    Views:
    3,696
    Arne Vajhøj
    Oct 11, 2008
Loading...

Share This Page