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

RFC5424Layout not working with parametrized messages

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-beta9, 2.0-rc1
    • 2.0-rc1
    • Core
    • Java 1.7.0_40

    Description

      Syslog (i.e RFC5424Layout) does not work with parametrized messages. If I do something like this:

      logger.info("Hello {}", "World");
      

      I get this at the syslog server:

      Oct 16 18:24:33 10.0.0.3 myApp Hello {}
      

      This is the config file I'm using:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration>
        <Appenders>
          <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{ISO8601}: %-5p [%t-%c{2}] - %m%n"/>
          </Console>
          <Syslog name="syslog" format="RFC5424" host="10.0.0.1" port="514" protocol="TCP" appName="myApp" facility="LOCAL0" newLine="true" includeMDC="true" id="App" reconnectionDelay="1000"/>
        </Appenders>
        <Loggers>
          <Root level="debug">
            <AppenderRef ref="STDOUT"/>
            <AppenderRef ref="syslog"/>
          </Root>
        </Loggers>
      </Configuration>
      

      The log to stdout is ok though.

      Attached you find my patch for this bug.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dags David Gstir
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: