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

Layout is no longer optional

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7
    • 2.7
    • Appenders
    • None

    Description

      This configuration used to work in 2.6.2:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="warn">
         <Appenders>
            <Console name="myConsole" target="SYSTEM_OUT"/>
            <Async name="myConsoleAsync">
               <AppenderRef ref="myConsole" />
            </Async>
         </Appenders>
         <Loggers>
            <AsyncRoot level="info" />
         </Loggers>
      </Configuration>
      

      With the current master (i.e. the upcoming 2.7) this does not work any more. The validator complains because the field "layout" is missing in

       <Console name="myConsole" target="SYSTEM_OUT" />
      

      According to the current documentation this is a bug:

      Parameter Name Type Description
      layout Layout The Layout to use to format the LogEvent. If no layout is supplied the default pattern layout of "%m%n" will be used.

      With this configuration it works:

      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="warn">
         <Appenders>
            <Console name="myConsole" target="SYSTEM_OUT">
               <DetailsLayout/>
            </Console>
            <Async name="myConsoleAsync">
               <AppenderRef ref="myConsole" />
            </Async>
         </Appenders>
         <Loggers>
            <AsyncRoot level="info" />
         </Loggers>
      </Configuration>
      

      Attachments

        Issue Links

          Activity

            People

              ggregory Gary D. Gregory
              SteffenO Steffen Offermann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: