我正在使用rsyslog将var / log / message提供给工具。但是,正如您所看到的那样,异常出现在多行(每行的不同时间戳)中,而不是记录为单行。我希望它看起来像catalina.out消息。有什么方法可以实现这一点。任何帮助都会很感激。
catalina.out看起来像这样:
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
var / log / message看起来像这样
2014-02-20T06:21:32.006782+00:00 something148-084-115 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
2014-02-20T06:21:32.006782+00:00 something148-084-115 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
2014-02-20T06:21:32.006784+00:00 something148-084-115 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
2014-02-20T06:21:32.006784+00:00 something148-084-115 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
2014-02-20T06:21:32.006786+00:00 something148-084-115 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
log4j.xml -
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} abc: [component="XYZ" priority="%p" thread="%t"] %c.%M:%L - %m%n" />
</layout>
</appender>
<appender name="syslog" class="org.apache.log4j.net.SyslogAppender">
<param name="syslogHost" value="localhost" />
<param name="threshold" value="INFO" />
<param name="facility" value="LOCAL0" />
<param name="facilityPrinting" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="abc: [component="XYZ" priority="%p" thread="%t"] %c.%M:%L - %m%n" />
</layout>
</appender>
<root>
<priority value="info" />
<appender-ref ref="console" />
<appender-ref ref="syslog" />
</root>
<logger name="org.springframework">
<level value="warn" />
</logger>
<logger name="org.hibernate">
<level value="warn" />
</logger>
</log4j:configuration>
由于