首页 > 代码库 > karaf加入自定义log4j的配置

karaf加入自定义log4j的配置

配置文件:


karaf_home/etc/org.ops4j.pax.logging.cfg


加入配置:


### direct log messages to stdout ###
log4j.appender.consoleout=org.apache.log4j.ConsoleAppender
log4j.appender.consoleout.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c:%L - %m%n

### direct messages to file myfile.log ###
log4j.appender.myfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.myfile.File=myfile.log
log4j.appender.myfile.DatePattern='.'yyyy-MM-dd
log4j.appender.myfile.layout=org.apache.log4j.PatternLayout
log4j.appender.myfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c:%L - %m%n


log4j.logger.org.my.shell=info, consoleout,myfile


日志显示: