Log4j的配置过程

1 下载地址:

 

http://jakarta.apache.org/log4j

 

2 Log4j的配置文件

 

文件名:log4j.properties

 

log4j.rootLogger=INFO, A1, A2

# A1 is set to be ConsoleAppender sending its output to System.out
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout

# The conversion pattern consists of date in ISO8601 format, level,
# thread name, logger name truncated to its rightmost two components
# and left justified to 17 characters, location information consisting
# of file name (padded to 13 characters) and line number, nested
# diagnostic context, the and the application supplied message

log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n

# Appender A2 writes to the file "".
log4j.appender.A2=org.apache.log4j.RollingFileAppender
log4j.appender.A2.File=${framework.home}/logs/run.log

# Overwrite the logs if it aleady exists.
log4j.appender.A2.Append=false

# Appender A2 uses the PatternLayout.
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n

你可能感兴趣的:(apache,thread,C++,c,log4j)