You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2019/08/13 15:26:00 UTC

[jira] [Updated] (LOG4J2-2636) No default value for mdcId in SyslogAppender

     [ https://issues.apache.org/jira/browse/LOG4J2-2636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers updated LOG4J2-2636:
--------------------------------
    Fix Version/s:     (was: 2.12.1)
                   2.13.0

> No default value for mdcId in SyslogAppender
> --------------------------------------------
>
>                 Key: LOG4J2-2636
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2636
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.11.2
>            Reporter: Filipp Gunbin
>            Priority: Major
>             Fix For: 2.13.0
>
>
> 1) Main issue
> When Rfc5424Layout is created from configuration, it seems to receive default value:
> {code:java}
> @PluginAttribute(value = "mdcId", defaultString = DEFAULT_MDCID) final String mdcId,{code}
> But SyslogAppender has it with no default:
> {code:java}
> @PluginBuilderAttribute("mdcId")
> private String mdcId;{code}
> It is used in SyslogAppender.build() to create Rfc5424Layout.  So, if I don't specify "mdcId" attribute in <Syslog>" config element, I get this exception:
> {quote}ERROR StatusLogger Could not create plugin of type class org.apache.logging.log4j.core.appender.SyslogAppender for element Syslog: java.lang.IllegalArgumentException: No structured id name was supplied java.lang.IllegalArgumentException: No structured id name was supplied at org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:146) at org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:130) at org.apache.logging.log4j.core.layout.Rfc5424Layout.<init>(Rfc5424Layout.java:142) at org.apache.logging.log4j.core.layout.Rfc5424Layout.createLayout(Rfc5424Layout.java:672) at org.apache.logging.log4j.core.appender.SyslogAppender$Builder.build(SyslogAppender.java:117) at org.apache.logging.log4j.core.appender.SyslogAppender$Builder.build(SyslogAppender.java:50)
> {quote}
> 2) Documentation doesn't mention mdcId of SyslogAppender at all: [https://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender]
> If I build site locally with "mvn site" in 2.11.2, it's not there either.
> 3) Commit ce1183629fe89625a77872c7153853e7774502a6 (https://issues.apache.org/jira/browse/LOG4J2-922) which introduces default value for mdcId in Rfc5424Layout has this code:
> {code:java}
> this.mdcId = id == null ? DEFAULT_MDCID : id;         
> this.mdcSdId = new StructuredDataId(mdcId, enterpriseNumber, null, null);{code}
> While "this.mdcId" is set in first line, the argument (not class member) mdcId is used in the second line.  Maybe argument mdcId should be used in the first line instead of "id"?  Maybe this.mdcId should be used in the second line instead of argument mdcId? I'm not familiar with the code enough to tell for sure, it just feels suspicious to me.
> Thanks.
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)