You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by pirzada rashid <pi...@gmail.com> on 2012/08/10 11:44:01 UTC

Log4j setting priority in properties file to Debug

I have tried and searched google but still don't have any solution.

I have INFO, ERROR and DEBUG in class files.

I understand below DEBUG all levels below it will be printed in log file
like INFO < WARN < ERROR < FATAL

***Question : How do I get only DEBUG level? . No package specific settings
please.***

    # Default Logging Level is DEBUG. levels: DEBUG < INFO < WARN < ERROR <
FATAL OR ALL. Its only appender to FILE.
    log = C:/log_files

    # Root logger option
    log4j.rootLogger = ERROR, FILE

    # Define the file appender
    # log4j.appender.FILE=org.apache.log4j.FileAppender

    # backup the log files when they reach a certain size
    log4j.appender.FILE=org.apache.log4j.RollingFileAppender

    # Set the name of the file
    log4j.appender.FILE.File=${log}/crud_jspservlet.out

    # Specify the log file size and max backup index.
    log4j.appender.Logger.MaxFileSize=5mb
    log4j.appender.Logger.MaxBackupIndex=20

    # Set the threshold to debug mode
    log4j.appender.FILE.Threshold=DEBUG

    # Set the append to false, overwrite
    log4j.appender.FILE.Append=false

    # Define the layout for file appender
    log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} -
[ %5p - %c{1}:%L ] --> %m%n%n