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 2021/03/02 03:24:00 UTC
[jira] [Comment Edited] (LOG4J2-3034) Change Log format based on
currently active level
[ https://issues.apache.org/jira/browse/LOG4J2-3034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293321#comment-17293321 ]
Ralph Goers edited comment on LOG4J2-3034 at 3/2/21, 3:23 AM:
--------------------------------------------------------------
The issue description stated "If it is debug I want a format with MDC - meaning I would want the MDC when my lowest level is debug or trace. If it is higher than that I want no MDC". The PatternSelector shown above does exactly what you asked for. If you want the selector to do something else you can either create a custom PatternSelector or use the ScriptPatternSelector and provide a custom script to determine which pattern you want.
was (Author: ralph.goers@dslextreme.com):
The issue description stated "If it is debug I want a format with MDC - meaning I would want the MDC when my lowest level is debug or trace. If it is higher than that I want no MDC". The PatternSelector shown above does exactly what you asked for.
> Change Log format based on currently active level
> -------------------------------------------------
>
> Key: LOG4J2-3034
> URL: https://issues.apache.org/jira/browse/LOG4J2-3034
> Project: Log4j 2
> Issue Type: New Feature
> Reporter: Caleb Cushing
> Priority: Major
>
> I'm not talking about `patternSelector`, I thought that was what I wanted, but I didn't understand it, I think. What I'm talking about is, if my root current active level is, for example, `error`, I want a format without MDC, if it's `debug` I want a format with MDC. meaning in error level, and all levels I would want the MDC when my lowest level is `debug` or trace. If it's higher than debug I want no MDC in my output. Pretty sure this is relatively easy to achieve with a programmatic configuration, but not without. The use case is to get far more verbose logging when debugging as opposed to normal "production" mode.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)