Jboss日志配置

这是log4j默认的配置,我们先熟悉一下  
<!-- ============================== -->  
<!-- Append messages to the console -->  
<!-- ============================== -->    
<!--输出方式:输出到控制台-->    
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">    
<!-- 设置通道名称:console和输出方式:org.apache.log4j.RollingFileAppender            
其中输出方式appender有5种,分别为
org.apache.log4j.ConsoleAppender (控制台)
org.apache.log4j.FileAppender (文件)           
org.apache.log4j.DailyRollingFileAppender (每天产生一个日志文件)           
org.apache.log4j.WriterAppender (将日志信息以流格式发送到任意指定的地方)-->
<param name="Target" value="System.out"/>    
<param name="Threshold" value="INFO"/>      
<!--Threshold是个全局的过滤器,它将把低于所设置的level的信息过滤不显示出来-->      
<!--level:是日记记录的优先级,优先级由高到低分为  OFF ,FATAL ,ERROR ,WARN ,INFO ,DEBUG ,ALL。
Log4j建议只使用FATAL ,ERROR ,WARN ,INFO ,DEBUG这四个级别。-->
<layout class="org.apache.log4j.PatternLayout">       
<!-- 配置日志输出的格式-->
参数都以%开始后面不同的参数代表不同的格式化信息(参数按字母表顺序列出):
%c  输出所属类的全名,可在修改为
%d{Num} ,Num类名输出的围  如:"org.apache.elathen.ClassName",  
%C{2}将输出elathen.ClassName    
%d 输出日志时间其格式为 %d{yyyy-MM-dd HH:mm:ss,SSS},可指定格式 如 %d{HH:mm:ss}              
%l 输出日志事件发生位置,包括类目名、发生线程,在代码中的行数              
%n 换行符              
%m 输出代码指定信息,如info(“message”),输出message              
%p 输出优先级,即 FATAL ,ERROR 等              
%r 输出从启动到显示该log信息所耗费的毫秒数              
%t 输出产生该日志事件的线程名      
<!-- The default pattern: Date Priority [Category] Message/n -->      
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>    
</layout>  
</appender>  
<!输出方式是:每天一个日志文件>  
<!-- A time/date based rolling appender -->  
<appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">    
<!--设置通道名称是:file,输出方式DailyRollingFileAppender-->    
<param name="File" value="${jboss.server.home.dir}/log/server.log"/>    
<!--日志文件路径和文件名称 -->    
<param name="Append" value="false"/>    
<!-- 设置是否在重新启动服务时,在原有日志的基础添加新日志 -->
<!-- Rollover at midnight each day -->    
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<!-- Rollover at the top of each hour    
<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>     -->
<layout class="org.apache.log4j.PatternLayout">      
<!-- The default pattern: Date Priority [Category] Message/n -->      
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message/n      
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>        -->    
</layout>      
</appender>

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/shangyu79/archive/2008/06/25/2585397.aspx

deploy/jbossweb-tomcat55.sar/server.xml <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" prefix="access_log." suffix=".log" pattern="%h %t %r %s %D" directory="${jboss.server.home.dir}/../output/logs" resolveHosts="false" /> http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html pattern配置: %a - Remote IP address %A - Local IP address %b - Bytes sent, excluding HTTP headers, or '-' if zero %B - Bytes sent, excluding HTTP headers %h - Remote host name (or IP address if resolveHosts is false) %H - Request protocol %l - Remote logical username from identd (always returns '-') %m - Request method (GET, POST, etc.) %p - Local port on which this request was received %q - Query string (prepended with a '?' if it exists) %r - First line of the request (method and request URI) %s - HTTP status code of the response %S - User session ID %t - Date and time, in Common Log Format %u - Remote user that was authenticated (if any), else '-' %U - Requested URL path %v - Local server name %D - Time taken to process the request, in millis %T - Time taken to process the request, in seconds %I - current request thread name (can compare later with stacktraces) There is also support to write information from the cookie, incoming header, outgoing response headers, the Session or something else in the ServletRequest. It is modeled after the apache syntax: %{xxx}i for incoming request headers %{xxx}o for outgoing response headers %{xxx}c for a specific request cookie %{xxx}r xxx is an attribute in the ServletRequest %{xxx}s xxx is an attribute in the HttpSession The shorthand pattern name common (which is also the default) corresponds to '%h %l %u %t "%r" %s %b'.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值