Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-901

Update docs for SyslogAppender: "No structured id name was supplied"

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.2
    • Appenders
    • None
    • Linux

    Description

      I'm using Log4j version 2.1 and trying to use a Syslog appender to log to a syslog server (rsyslog). I'm using the configuration given at the official site (http://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender):

      <Syslog name="RFC5424" format="RFC5424" host="localhost" port="514"
              protocol="UDP" appName="MyApp" includeMDC="true"
              facility="LOCAL0" enterpriseNumber="18060" newLine="true"
              messageId="Audit" id="App"/>
      

      When I start my app and do a LogManager.getLogger(), I get an error:

      014-11-17 18:26:23,640 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.SyslogAppender for element Syslog. 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:135)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
        at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
        at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:426)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:408)
        at Log.<clinit>(Log.java:7)
      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:139)
        at org.apache.logging.log4j.core.layout.Rfc5424Layout.createLayout(Rfc5424Layout.java:657)
        at org.apache.logging.log4j.core.appender.SyslogAppender.createAppender(SyslogAppender.java:133)
      ... 19 more
      

      The same thing works on an older version of log4j 2.0-beta9.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            tmescic Tihomir Meščić
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment