log4j: disable output for console (root-logger)

Discussion in 'Java' started by Joerg Lensing, Jan 8, 2004.

  1. Hi ng,
    I want to disable the output to the console when logging to file. See
    config-file below:


    log4j.rootLogger=INFO, A1

    log4j.logger.de.softcon.webcontrol.presentation=DEBUG,A3
    log4j.logger.com.cappuccinonet.strutscx=WARN
    log4j.logger.org.apache=WARN

    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=%d %-5p - %m%n



    log4j.appender.A3=org.apache.log4j.FileAppender
    log4j.appender.A3.File=C:\\joergslog2.log
    log4j.appender.A3.layout=org.apache.log4j.PatternLayout
    log4j.appender.A3.layout.ConversionPattern=<userClick time="%d" thread="%t" %m />%n


    I call the log by:
    Logger debugLogger = Logger.getLogger("de.softcon.webcontrol.presentation");
    debugLogger.debug("some logging output");

    How can I disable the output to console(System.out)??

    tx joerg
     
    Joerg Lensing, Jan 8, 2004
    #1
    1. Advertising

  2. Joerg Lensing

    GaryM Guest

    (Joerg Lensing) wrote in
    news::

    >
    > Hi ng,
    > I want to disable the output to the console when logging to file.
    > See config-file below:
    >
    >
    > log4j.rootLogger=INFO, A1
    >


    comment out the A1 above and you're good to go.
     
    GaryM, Jan 8, 2004
    #2
    1. Advertising

  3. Your appender A1 is defined as a ConsoleAppender. Remove A1 as appender
    entirely or make it a FileAppender. Also I'm not sure where INFO will go if
    you don't specify the appender type.

    Simon


    "Joerg Lensing" <> wrote in message
    news:...
    > Hi ng,
    > I want to disable the output to the console when logging to file. See
    > config-file below:
    >
    >
    > log4j.rootLogger=INFO, A1
    >
    > log4j.logger.de.softcon.webcontrol.presentation=DEBUG,A3
    > log4j.logger.com.cappuccinonet.strutscx=WARN
    > log4j.logger.org.apache=WARN
    >
    > log4j.appender.A1=org.apache.log4j.ConsoleAppender
    > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    > log4j.appender.A1.layout.ConversionPattern=%d %-5p - %m%n
    >
    >
    >
    > log4j.appender.A3=org.apache.log4j.FileAppender
    > log4j.appender.A3.File=C:\\joergslog2.log
    > log4j.appender.A3.layout=org.apache.log4j.PatternLayout
    > log4j.appender.A3.layout.ConversionPattern=<userClick time="%d"

    thread="%t" %m />%n
    >
    >
    > I call the log by:
    > Logger debugLogger =

    Logger.getLogger("de.softcon.webcontrol.presentation");
    > debugLogger.debug("some logging output");
    >
    > How can I disable the output to console(System.out)??
    >
    > tx joerg
     
    Simon Niederberger, Feb 12, 2004
    #3
    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. sachin
    Replies:
    1
    Views:
    984
    Soren Kuula
    Feb 3, 2006
  2. sznury
    Replies:
    0
    Views:
    587
    sznury
    Apr 23, 2009
  3. Christophe Broult
    Replies:
    0
    Views:
    210
    Christophe Broult
    Oct 14, 2005
  4. cap
    Replies:
    3
    Views:
    303
    James Edward Gray II
    Dec 11, 2005
  5. Georges Ko
    Replies:
    4
    Views:
    283
    Georges Ko
    Jul 26, 2006
Loading...

Share This Page