logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LOG4J2-1332) Null/empty messages are not handled properly in RFC5424Layout
Date Sat, 02 Jul 2016 20:39:11 GMT

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

Ralph Goers resolved LOG4J2-1332.
    Resolution: Not A Problem

Actually, I misread the document the overall grammar of a syslog message is 


so the message is optional and the current code is correct. Also, example 4 in section 6 shows
a syslog message with only structured data and no message text.

The only thing we are doing incorrectly is not checking for a null Message in the LogEvent,
but that really should have been checked or caused other problems long before here.

If you agree with this please close. Otherwise, please provide a reference to where this disagrees
with the spec.

> Null/empty messages are not handled properly in RFC5424Layout
> -------------------------------------------------------------
>                 Key: LOG4J2-1332
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1332
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>            Reporter: Michael Day
>            Assignee: Ralph Goers
> In the following code snippet, you can see that null/empty messages are not appended
to the buffer. This results in a violation of RFC5424.
> {code}
>     private void appendMessage(StringBuilder buffer, LogEvent event) {
>         Message message = event.getMessage();
>         String text = message instanceof StructuredDataMessage?message.getFormat():message.getFormattedMessage();
>         if(text != null && text.length() > 0) {
>             buffer.append(' ').append(this.escapeNewlines(text, this.escapeNewLine));
>         }
>         ...
> }
> {code}

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message