[
https://issues.apache.org/jira/browse/LOG4J2-1015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14545737#comment-14545737
]
Remko Popma commented on LOG4J2-1015:
-------------------------------------
I believe (please correct me if I'm wrong) that your use case for this request
is documented here:
http://stackoverflow.com/questions/30086459/how-to-log-fatal-or-any-custom-log-level-with-slf4j-and-log4j2/30241828?noredirect=1#comment48624927_30241828
Basically you want to use the FATAL level, and at the same time you want your
application to only use SLF4J (and avoid depending on log4j2). SLF4J does not
have a FATAL level. It does have markers, but a layout like {{"%d %level
%marker %msg"}} shows something like {{09:00:00 ERROR FATAL A fatal error
occurred}} and you would prefer to instead show {{09:00:00 FATAL A fatal error
occurred}}.
As a workaround you are configuring two appenders, where one of them has layout
{{"%d FATAL %marker %msg"}} and the other {{"%d %level %marker %msg"}}. You now
want to use the RoutingAppender to route LogEvents with the FATAL marker to the
appender with the first layout, and other log events to the appender with the
%level layout.
However, RoutingAppender does not support routing based on markers, it only
supports routing based on the ThreadContextMap. Hence this request to support
routing based on markers.
Can you confirm if my understanding is correct?
> Add a way to route messages based on the %marker in Layout for RoutingAppender
> ------------------------------------------------------------------------------
>
> Key: LOG4J2-1015
> URL: https://issues.apache.org/jira/browse/LOG4J2-1015
> Project: Log4j 2
> Issue Type: New Feature
> Components: Appenders
> Affects Versions: 2.2
> Reporter: Daniel Marcotte
>
> Hi,
> It seems there's no way to route messages based on the Marker in the
> RoutingAppender. The "%marker" is not part of the Layout. When using SLF4J,
> since it's a core feature of the facade, this would help greatly if it was
> possible to route messages based on the Marker.
> Main StackOverFlow question (still unanswered) :
> http://stackoverflow.com/questions/30111754/log4j2-is-there-a-way-to-route-logs-based-on-marker-with-the-routingappender
> Workaround StackOverFlow question (answered) :
> http://stackoverflow.com/questions/30247323/how-to-create-custom-rewritepolicy-in-log4j2
> Thank you
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]