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

PatternLayout can't put newline in substitution

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5
    • None
    • None
    • None

    Description

      I try this configuration:

      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %replace{%m}{\n}{\n\t}%n"/>
      

      And log message like this:

      LOG.error("This\n" + 
                "is\n" + 
                "multiline\n" + 
                "log\n" + 
                "message");
      

      Result:

      	
      15:42:11.364 [main] ERROR com.company.test.Main - Thisntisntmultilinentlogntmessage
      

      Is there a possibility to get this result:

      15:42:11.364 [main] ERROR com.company.test.Main - This
          is
          multiline
          log
          message
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Delphin Delphin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: