log4j使用示例 博客分类: Log4j log4jApacheSpringCC++
程序员文章站
2024-03-08 13:36:40
...
在使用的类中添加成员变量就可以。
private Log logger = LogFactory.getLog(Hello.class);
# Configure logging for testing: optionally with log file
#log4j.rootLogger=WARN, stdout,A2
#log4j.rootLogger=INFO, stdout,A2
log4j.rootLogger=INFO, stdout
#the Word upon "WARN" is the level that log4j will output
#there are five levels can be used to control the log4j
# FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7
#the Word upon "stdout" represents the place where log4j will put
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = ERROR
# log4j.rootLogger=WARN, stdout, logfile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.File=target/spring.log
log4j.appender.logfile.append=false
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.A2 = org.apache.log4j.RollingFileAppender
#log4j.appender.A2.File = logs\\test.log
#log4j.appender.A2.File =D\:\\test.log
log4j.appender.A2.File =D\:\\test.log
log4j.appender.A2.MaxFileSize = 1MB
log4j.appender.A2.MaxBackupIndex = 3
log4j.appender.A2.layout = org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern =[%d] %-4r [%t] %-5p %c %x - %m %n
private Log logger = LogFactory.getLog(Hello.class);
# Configure logging for testing: optionally with log file
#log4j.rootLogger=WARN, stdout,A2
#log4j.rootLogger=INFO, stdout,A2
log4j.rootLogger=INFO, stdout
#the Word upon "WARN" is the level that log4j will output
#there are five levels can be used to control the log4j
# FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7
#the Word upon "stdout" represents the place where log4j will put
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = ERROR
# log4j.rootLogger=WARN, stdout, logfile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.File=target/spring.log
log4j.appender.logfile.append=false
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.A2 = org.apache.log4j.RollingFileAppender
#log4j.appender.A2.File = logs\\test.log
#log4j.appender.A2.File =D\:\\test.log
log4j.appender.A2.File =D\:\\test.log
log4j.appender.A2.MaxFileSize = 1MB
log4j.appender.A2.MaxBackupIndex = 3
log4j.appender.A2.layout = org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern =[%d] %-4r [%t] %-5p %c %x - %m %n
上一篇: compass 分页查询 博客分类: Compass Lucene XML
下一篇: 用compass快速给你的网站添加搜索功能<二> 博客分类: Compass Lucene log4jJ#BeanSpringfreemarker
推荐阅读
-
log4j使用示例 博客分类: Log4j log4jApacheSpringCC++
-
如何使用Log4j 博客分类: Log4j log4jApacheCC++C#
-
如何使用Log4j 博客分类: Log4j log4jApacheCC++C#
-
spring集成log4j配置信息 博客分类: java编程
-
征服flume之三——使用log4j输出日志到flume 博客分类: 企业架构 flumelog4javrosink
-
征服flume之三——使用log4j输出日志到flume 博客分类: 企业架构 flumelog4javrosink
-
利用【监听器】动态加载Log4j配置文件 博客分类: log4jJavaWeb weblog4j
-
Log4j 动态更新配置文件【热配置】 博客分类: log4j log4jjava
-
利用【监听器】动态加载Log4j配置文件 博客分类: log4jJavaWeb weblog4j
-
Log4j 动态更新配置文件【热配置】 博客分类: log4j log4jjava