I am using log4j2 and syslog appender. I am using TCP as protocol. and Kiwi syslog server. While sending the error messages, the exception stacktrace is being sent over TCP in multiple lines, each line in one one packet. The first line of the stacktrace is shwoing correct log level in Kiwi syslog server, but the subsequent of the same stacktrace is shwoing wrong log level and facility. This is not happening in case of UDP protocol.
01-22-2015 10:25:40 Local0.Error 10.74.224.251 1 2015-01-23T00:20:11.473+05:30 ABC-PC - - [mdc@1000 category="com.test.dataSender" exception="" thread="ForkJoinPool-57-worker-1"] [8ef587c9-5605-42d3-88ff-0d865cf6e510]: Failed to add management service instance 'aa', Cause: aa
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 " thread="ForkJoinPool-57-worker-1"] [8ef587c9-5605-42d3-88ff-0d865cf6e510]: Unknown Host : aa
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:398)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.ForkJoinPool.work(ForkJoinPool.java:646)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:784)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.ForkJoinWorkerThread.execTask(ForkJoinWorkerThread.java:604)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:334)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:93)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.core.mapreduce.MapReduceTask.compute(MapReduceTask.java:26)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.core.datasource.DatasourceAdder.map(DatasourceAdder.java:21)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.core.datasource.DatasourceAdder.map(DatasourceAdder.java:70)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.um.datasource.UMDatasourceService.addDatasources(UMDatasourceService.java:58)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.um.datasource.UMDatasourceServiceFacadeImpl.addDatasources(UMDatasourceServiceFacadeImpl.java:211)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at com.test.data.um.datasource.UMDatasourceServiceFacadeImpl.discoverDatasources(UMDatasourceServiceFacadeImpl.java:248)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress.getByName(InetAddress.java:1048)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress.getAllByName(InetAddress.java:1098)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress.getAllByName(InetAddress.java:1162)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
01-22-2015 10:25:39 Local7.Debug 10.74.224.251 at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
01-22-2015 10:25:39 Local0.Error 10.74.224.251 1 2015-01-23T00:20:11.471+05:30 ABC-PC [OnCommand API Services] - - [mdc@1000 category="com.test.data.um.datasource.UMDatasourceServiceFacadeImpl" exception="java.net.UnknownHostException: aa
Another questions regarding [mdc@1000
what is this? why this is getting printed. I have added includeMDC=true
in log4j2 config file.
<Syslog name="syslogAppender"
host="${sys:syslog.host}" port="${sys:syslog.port}" protocol="${sys:syslog.protocol}"
appName="${serviceName}" enabled="${sys:syslog.enabled}" format="RFC5424"
newLine="true" includeMDC="true" mdcId="mdc" ignoreExceptions="true"
enterpriseNumber="1000">
<LoggerFields>
<KeyValuePair key="thread" value="%t" />
<KeyValuePair key="category" value="%c" />
<KeyValuePair key="exception" value="%ex{full}" />
</LoggerFields>
</Syslog>