Linux下jboss6.1.0日志输出设置

本文介绍了在Linux环境下,如何设置JBoss 6.1.0的日志输出,包括DatePattern属性的设置,以实现日志按天或按小时滚动。还详细讲解了日志级别的配置,如FATAL、ERROR、WARN、INFO、DEBUG。此外,文章提及了Log4j的几种appender和layout,如ConsoleAppender、DailyRollingFileAppender、PatternLayout等,并提供了日志格式的定制方法。
摘要由CSDN通过智能技术生成

最近一段时间发现项目用了JBoss之后日志变得非常大。都是好几百兆了。于是在网上查找一些文档自己整理了一下关于JBoss日志的输出设置,我们先看下面一段代码

 

#运行和错误日志写到文件
log4j.appender.RunningLog =org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.RunningLog.key=bundle.name
log4j.appender.RunningLog.default=jboss
log4j.appender.RunningLog.appender=org.apache.log4j.DailyRollingFileAppender
#Rollover at the top of each day 
log4j.appender.RunningLog.appender.DatePattern ='.'yyyy-MM-dd
log4j.appender.RunningLog.appender.file=${karaf.data}/log/$\\{bundle.name\\}/RunningLog.log
log4j.appender.RunningLog.appender.append=true
log4j.appender.RunningLog.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.RunningLog.appender.layout.ConversionPattern=
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
发出的红包

打赏作者

JAIR_FOREVER

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值