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

Name attribute should not be required in the properties format

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.10.0
    • Fix Version/s: None
    • Component/s: Configurators
    • Labels:
      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

            • Assignee:
              Unassigned
              Reporter:
              icesunrise Dmitry Bigunyak

              Dates

              • Created:
                Updated:

                Issue deployment