Dmitry Bigunyak created LOG4J2-2159:
---------------------------------------
Summary: Name attribute should not be required in the properties
format
Key: LOG4J2-2159
URL: https://issues.apache.org/jira/browse/LOG4J2-2159
Project: Log4j 2
Issue Type: Wish
Components: Configurators
Affects Versions: 2.10.0
Reporter: Dmitry Bigunyak
Priority: Minor
I struggle to understand why {{name}} attribute is required in the properties
format.
Have a look at this trivial config:
{code}
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
{code}
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|https://logging.apache.org/log4j/2.x/manual/configuration.html#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.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)