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

Name attribute should not be required in the properties format

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.10.0
    • None
    • Configurators
    • None

    Description

      I struggle to understand why name attribute is required in the properties format.
      Have a look at this trivial config:

      appenders = console
      
      appender.console.type = Console
      appender.console.name = STDOUT
      appender.console.layout.type = PatternLayout
      appender.console.layout.pattern = [%-5p] %m%n
      
      rootLogger.level = debug
      rootLogger.appenderRef.console.ref = STDOUT
      

      I know that "appenders = console" string is not necessary which is good but omitting the name attribute for appender results in "No name attribute provided for Appender console" error. The question is why it can't use the component's console name by default? It's supper confusing that I have to introduce a new name, STDOUT in this case, to reference appender from the logger. I'd rather use the same console appender's component name, which is much more natural.
      Sorry, if I'm suggesting something that is totally wrong, I'm new to log4j and trying to make sense of it from the documentation which is not well structured to say the least.
      Maybe at least Configuration with Properties section in the documentation could be completed by mentioning that the name attribute is required? Right now it only states that the type attribute must be specified.

      Attachments

        Activity

          People

            Unassigned Unassigned
            icesunrise Dmitry Bigunyak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: