How to consolidate multiline logs in syslog using log4j

I upload my var / log / message file with rsyslog to the tool. But, since you can see that the exception appears in several lines (different timestamps for each line), and is not registered as one line. I would like it to be like catalina.out post. Is there any way to achieve this. Any help would be appreciated.

catalina.out is as follows:

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 is as follows

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=&quot;XYZ&quot; priority=&quot;%p&quot; thread=&quot;%t&quot;] %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=&quot;XYZ&quot; priority=&quot;%p&quot; thread=&quot;%t&quot;] %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>

thank

+3
source share

All Articles