I am feeding my var/log/message
using rsyslog
from a tool. The exception appears in multiple lines (on line per message) rather than logging it as one multi-line message.
I would like my /var/log/message
to look like the catalina.out
message. Is there any way I can achieve this?
The catalina.out
with one multi-line message:
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)
The var/log/message
which is splitted into multiple messages:
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)
The log4j.xml
config:
<?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>