Discussion:
[jira] [Created] (LOG4J2-818) Missing field 'application' in SocketAppender/SerializedLayout/LogEvent
Benedikt Westphal (JIRA)
2014-09-08 14:38:28 UTC
Permalink
Benedikt Westphal created LOG4J2-818:
----------------------------------------

Summary: Missing field 'application' in SocketAppender/SerializedLayout/LogEvent
Key: LOG4J2-818
URL: https://issues.apache.org/jira/browse/LOG4J2-818
Project: Log4j 2
Issue Type: Improvement
Components: Appenders, Layouts
Affects Versions: 2.0.2
Reporter: Benedikt Westphal


The SocketAppender in Log4j1 had a field called 'application' that is missing in the SocketAppender and in the LogEvent of Log4j2. After migration you could not see which application was logging which logmessages on the logging server. The Log4jLogEvent and the SocketAppender should be enhanced to hold this information.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Ralph Goers (JIRA)
2014-09-08 23:48:28 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126325#comment-14126325 ]

Ralph Goers commented on LOG4J2-818:
------------------------------------

You can achieve this by wrapping the SocketAppender in a RewriteAppender such as:
{code}
<Appenders>
<Socket name="socket" host="localhost" port="9500">
<SerializedLayout />
</Socket>
<Rewrite name="rewrite">
<AppenderRef ref="socket/>
<MapRewritePolicy mode="Add">
<KeyValuePair key="application" value="MyApp"/>
</MapRewritePolicy>
</Rewrite>
</Appenders>
{code}

Does that meet your requirements?
Post by Benedikt Westphal (JIRA)
Missing field 'application' in SocketAppender/SerializedLayout/LogEvent
-----------------------------------------------------------------------
Key: LOG4J2-818
URL: https://issues.apache.org/jira/browse/LOG4J2-818
Project: Log4j 2
Issue Type: Improvement
Components: Appenders, Layouts
Affects Versions: 2.0.2
Reporter: Benedikt Westphal
The SocketAppender in Log4j1 had a field called 'application' that is missing in the SocketAppender and in the LogEvent of Log4j2. After migration you could not see which application was logging which logmessages on the logging server. The Log4jLogEvent and the SocketAppender should be enhanced to hold this information.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Benedikt Westphal (JIRA)
2014-09-09 06:52:29 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126702#comment-14126702 ]

Benedikt Westphal commented on LOG4J2-818:
------------------------------------------

# MapRewritePolicy only works with MapMessage and not for normal log statements.
# RewriteAppender is very ressource expensive because it has to modify an immutable object by recreating it with new properties.

So, no, it is not what i am looking for.
Post by Benedikt Westphal (JIRA)
Missing field 'application' in SocketAppender/SerializedLayout/LogEvent
-----------------------------------------------------------------------
Key: LOG4J2-818
URL: https://issues.apache.org/jira/browse/LOG4J2-818
Project: Log4j 2
Issue Type: Improvement
Components: Appenders, Layouts
Affects Versions: 2.0.2
Reporter: Benedikt Westphal
The SocketAppender in Log4j1 had a field called 'application' that is missing in the SocketAppender and in the LogEvent of Log4j2. After migration you could not see which application was logging which logmessages on the logging server. The Log4jLogEvent and the SocketAppender should be enhanced to hold this information.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...