logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: Exception when using Syslog appender with RFC5424 layout
Date Tue, 13 Jan 2015 15:59:44 GMT
On Tue, Jan 13, 2015 at 10:41 AM, David KOCH <dkoch@ezakus.com> wrote:

> Hi,
>
> It's been a while but I think the resolution was that one needs to provide
> the mdcId attribute in the Syslog appender configuration when using the
> RFC5424 layout. It's not documented but evident when looking in the source.
> Not sure this behaviour changed in log4j2 2.1.
>

Ah right, that rings a bell. I must have deleted that part of the thread.
Thank you for the reminder.

Gary


> Regards,
>
> /David
>
> On 13 January 2015 at 16:32, Gary Gregory <garydgregory@gmail.com> wrote:
>
> > Can you please try to see if you get the same result with 2.1?
> >
> > Thank you,
> > Gary
> >
> > On Thu, Oct 30, 2014 at 7:47 PM, David KOCH <dkoch@ezakus.com> wrote:
> >
> > > Hello,
> > >
> > > Log4j2 version is 2.0.2, my Syslog appender is configured like so:
> > >
> > > <Syslog name="LogStash"  format="RFC5424" host="192.168.232.191"
> > > port="5000" protocol="UDP"/>
> > >
> > > and I get the following exception:
> > >
> > > 2014-10-31 00:36:40,916 DEBUG Calling createAppender on class
> > > org.apache.logging.log4j.core.appender.SyslogAppender for element
> Syslog
> > > with params(host="192.168.232.191", port="5000", protocol="UDP", null,
> > > reconnectionDelay="0", immediateFail="true", name="LogStash",
> > > immediateFlush="true", ignoreExceptions="true", facility="LOCAL0",
> > > id="bidder", enterpriseNumber="18060", includeMdc="true", mdcId="null",
> > > mdcPrefix="null", eventPrefix="null", newLine="false",
> > > newLineEscape="null", appName="null", messageId="audit",
> > > mdcExcludes="null", mdcIncludes="null", mdcRequired="null",
> > > format="RFC5424", null,
> > > Configuration(/Users/xxxx/Work/xxxxx/scripts/log4j2.xml),
> > charset="UTF-8",
> > > exceptionPattern="null", ={}, advertise="false")
> > > 2014-10-31 00:36:41,018 DEBUG Generated plugins in 0.099533 seconds,
> > > packages: [org.apache.logging.log4j.core], preload: false.
> > > 2014-10-31 00:36:41,019 ERROR catching
> > > java.lang.reflect.InvocationTargetException
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > at java.lang.reflect.Method.invoke(Method.java:606)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:133)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:744)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:683)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:675)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:349)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:150)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:364)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:422)
> > > at
> > >
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:146)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:85)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37)
> > > at org.apache.logging.log4j.LogManager.getContext(LogManager.java:269)
> > > at
> > >
> > >
> >
> org.apache.logging.slf4j.Log4jLoggerFactory$PrivateManager.getContext(Log4jLoggerFactory.java:98)
> > > at
> > >
> > >
> >
> org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:84)
> > > at
> > >
> > >
> >
> org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:44)
> > > at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:277)
> > > at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
> > > at
> > >
> > >
> >
> com.google.openbidder.server.ServiceWrapper.<clinit>(ServiceWrapper.java:62)
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > at java.lang.reflect.Method.invoke(Method.java:606)
> > > at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> > > at java.lang.Thread.run(Thread.java:724)
> > > Caused by: java.lang.IllegalArgumentException: No structured id name
> was
> > > supplied
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:92)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.layout.Rfc5424Layout.<init>(Rfc5424Layout.java:135)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.layout.Rfc5424Layout.createLayout(Rfc5424Layout.java:651)
> > > at
> > >
> > >
> >
> org.apache.logging.log4j.core.appender.SyslogAppender.createAppender(SyslogAppender.java:130)
> > > ... 28 more
> > >
> > > I don't get the same exception when I don't specify the format. What
> > could
> > > be wrong?
> > >
> > > Thank you,
> > >
> > > /David
> > >
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > Java Persistence with Hibernate, Second Edition
> > <http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > Spring Batch in Action <http://www.manning.com/templier/>
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
> >
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message