Log4j configuration: how to suppress internal logs from Log4j?

Discussion in 'Java' started by joes, Aug 6, 2005.

  1. joes

    joes Guest

    Hello

    I am using log4j (v1.2.8) in a tomcat 5 servlet environment.
    The log4j output often contains a lot of internal logs about the adding
    and removal of loggers, i.e.:

    log4j:INFO Returning existing logger [class xy...] in repository
    [default].
    log4j:INFO Returning existing logger [class xz..] in repository
    [default].
    log4j:INFO Creating new logger [class xv ...] in repository [default].


    How can I suppress that? I tried already with the debug switch of the
    configuration, but this didn't help. The "debug" or "configDebug" seems
    to getting ignored. Any thoughts?

    <configuration xmlns="http://logging.apache.org/" configDebug="false"
    debug="false">

    ....

    </configuration>

    thanks
    Mark Egloff
     
    joes, Aug 6, 2005
    #1
    1. Advertising

  2. joes

    joes Guest

    I found a way by myself but is currently not so satisfying. I f someone
    has another solution i.e. by using the configuration please let me
    know.

    http://www.mail-archive.com//msg03964.html


    Have a look at the class "org.apache.log4j.helpers.LogLog" This class
    is used to print out the internal stuff about the internal loggers.
    i.e.

    class Hierarchy:

    LogLog.info(
    "Creating new logger ["+name+"] in repository
    ["+getName()+"].");


    class LogLog:

    public static void info(String msg) {
    if ( !quietMode) {
    System.out.println(INFO_PREFIX + msg);
    }
    }

    The LogLog offers a flag "quietMode" which can be set via the method
    "setQuietMode(boolean)". As default the flag is turned off.

    Unfortunately I haven't found a way to configure it via the
    configuration file because it seems not to be implemented. So the way
    is either to modify this class and set the "quietMode" to "true" or to
    call from any point of your application this static function.

    org.apache.log4j.helpers.LogLog.setQuietMode(true);

    hope this helps

    regards
    Mark Egloff
     
    joes, Aug 6, 2005
    #2
    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. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,782
    Alexandra Stehman
    Jan 19, 2004
  2. Arvind
    Replies:
    2
    Views:
    13,471
    Rajesh Tihari
    May 24, 2004
  3. Alex Hunsley
    Replies:
    2
    Views:
    12,946
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  4. Rodolfo
    Replies:
    0
    Views:
    959
    Rodolfo
    Jul 12, 2004
  5. Miguelon cosapi data

    Login IP remote in the logs Log4J

    Miguelon cosapi data, Nov 28, 2006, in forum: Ruby
    Replies:
    1
    Views:
    261
    Miguelon cosapi data
    Nov 28, 2006
Loading...

Share This Page