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

RFC5424Layout not working with parametrized messages

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta9, 2.0-rc1
    • Fix Version/s: 2.0-rc1
    • Component/s: Core
    • Labels:
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: