`

Log4j knowledge note

阅读更多
Log4j pattern format explain:
  %m 输出代码中指定的消息
  %p 输出优先级,即DEBUG,INFO,WARN,ERROR,FATAL 
  %r 输出自应用启动到输出该log信息耗费的毫秒数 
  %c 输出所属的类目,通常就是所在类的全名 
  %t 输出产生该日志事件的线程名 
  %n 输出一个回车换行符,Windows平台为“rn”,Unix平台为“n” 
  %d 输出日志时间点的日期或时间,默认格式为ISO8601,也可以在其后指定格式,比如:%d{yyyy MMM dd HH:mm:ss,SSS},输出类似:2002年10月18日 22:10:28,921 
  %l 输出日志事件的发生位置,包括类目名、发生的线程,以及在代码中的行数。

  #log4j.properties sample 
log4j.rootLogger = DEBUG, A1  
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#日志文件 每日
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.File=c:/mylog.txt
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
#%时间  [%线程] %log级别 %完整类名 - %消息 %换行
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
分享到:
评论

相关推荐

    微软内部资料-SQL性能优化2

    Troubleshooting server performance-based support calls requires product knowledge, good communication skills, and a proven troubleshooting methodology. In this module we will discuss Microsoft® SQL ...

    微软内部资料-SQL性能优化3

    [BULK-OP-LOG] – Bulk Operation Lock for Log Table Lock Sub-Resources: Full Table Lock (default) [UPD-STATS] – Update statistics Lock [COMPILE] – Compile Lock Index Lock sub-Resources: Full Index ...

    数据库设计文档1

    `redtext`(红字提示),`class`(科目),`chapter`(章节),`knowledge`(试题类别),`difficulty`(难度),`conttype`(题型),`practice`(实践类型),`intensive`(强化练习)等字段。这些字段覆盖了试题的所有关键属性,...

    联想旭日420AXP系统芯片组驱动

    Refer to Section 4 for more information. ************************************************************ * 4. LIST OF AVAILABLE COMMAND LINE FLAG OPTIONS ********************************************...

    NewSID(光学习一下代码就可以了,没看清楚介绍别运行)

    NewSID works Windows NT 4, Windows 2000, Windows XP and Windows .NET Server. Please read this entire article before you use this program.Version Information: Version 4.0 introduces support for ...

    apktool documentation

    Warning Apktool has no knowledge of what version of framework resides there. It will assume its up to date, so delete the file during Apktool upgrades Managing framework files Frameworks are stored ...

    微软内部资料-SQL性能优化5

    Lesson 4: Information Collection and Analysis 61 Lesson 5: Formulating and Implementing Resolution 75 Module 6: Troubleshooting Query Performance Overview At the end of this module, you ...

    C# Game Programming Cookbook for Unity 3D - 2014

    4. Recipes: Common Components 41 4.1 Introduction.......................................................41 4.2 The Timer Class....................................................43 4.2.1 Script ...

Global site tag (gtag.js) - Google Analytics