[ 
https://issues.apache.org/jira/browse/LOG4J2-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17478060#comment-17478060
 ] 

Gary D. Gregory edited comment on LOG4J2-3340 at 1/20/22, 1:05 PM:
-------------------------------------------------------------------

Great explanation [~rgoers] , TY.

The bottom line here IMO, is that we need better docs:

I added some internal Javadoc for the StatusLogger

{noformat}
   /**
     * Constructs the singleton instance for the STATUS_LOGGER constant.
     * <p>
     * This is now the logger level is set:
     * </p>
     * <ol>
     * <li>If the property {@value Constants#LOG4J2_DEBUG} is {@code "true"}, 
then use {@link Level#TRACE}, otherwise,</li>
     * <li>Use {@link Level#ERROR}</li>
     * </ol>
     * <p>
     * This is now the listener level is set:
     * </p>
     * <ol>
     * <li>If the property {@value #DEFAULT_STATUS_LISTENER_LEVEL} is set, then 
use <em>it</em>, otherwise,</li>
     * <li>Use {@link Level#WARN}</li>
     * </ol>
     * <p>
     * See:
     * <ol>
     * <li>LOG4J2-1813 Provide shorter and more intuitive way to switch on 
Log4j internal debug logging. If system property
     * "log4j2.debug" is defined, print all status logging.</li>
     * <li>LOG4J2-3340 StatusLogger's log Level cannot be changed as 
advertised.</li>
     * </ol>
     * </p>
     * 
     * @param name The logger name.
     * @param messageFactory The message factory.
     */
{noformat}
What this means is that you need the StatusLogger level set to a level that 
will allow the listeners in the StatusLogger to kick in.


was (Author: garydgregory):
Great explanation [~rgoers] , TY.

The bottom line here IMO, is that we need better docs:

I added some internal Javadoc for the StatusLogger

This is now the logger level is set:
 # If the property 
["log4j2.debug"|eclipse-javadoc:%E2%98%82=log4j-api/src%5C/main%5C/java=/optional=/true=/=/maven.pomderived=/true=/%3Corg.apache.logging.log4j.util%7BConstants.java%E2%98%83Constants%5ELOG4J2_DEBUG]
 is {{{}"true"{}}}, then use 
{{{}[Level.TRACE|eclipse-javadoc:%E2%98%82=log4j-api/src%5C/main%5C/java=/optional=/true=/=/maven.pomderived=/true=/%3Corg.apache.logging.log4j.status%7BStatusLogger.java%E2%98%83StatusLogger~StatusLogger~QString;~QMessageFactory;%E2%98%82Level%E2%98%82TRACE]{}}},
 otherwise,
 # Use 
{{[Level.ERROR|eclipse-javadoc:%E2%98%82=log4j-api/src%5C/main%5C/java=/optional=/true=/=/maven.pomderived=/true=/%3Corg.apache.logging.log4j.status%7BStatusLogger.java%E2%98%83StatusLogger~StatusLogger~QString;~QMessageFactory;%E2%98%82Level%E2%98%82ERROR]}}

This is now the listener level is set:
 # If the property 
["log4j2.StatusLogger.level"|eclipse-javadoc:%E2%98%82=log4j-api/src%5C/main%5C/java=/optional=/true=/=/maven.pomderived=/true=/%3Corg.apache.logging.log4j.status%7BStatusLogger.java%E2%98%83StatusLogger%5EDEFAULT_STATUS_LISTENER_LEVEL]
 is set, then use {_}it{_}, otherwise,
 # Use 
{{[Level.WARN|eclipse-javadoc:%E2%98%82=log4j-api/src%5C/main%5C/java=/optional=/true=/=/maven.pomderived=/true=/%3Corg.apache.logging.log4j.status%7BStatusLogger.java%E2%98%83StatusLogger~StatusLogger~QString;~QMessageFactory;%E2%98%82Level%E2%98%82WARN]}}

What this means is that you need the StatusLogger level set to a level that 
will allow the listeners in the StatusLogger to kick in.

> StatusLogger's log Level cannot be changed as advertised
> --------------------------------------------------------
>
>                 Key: LOG4J2-3340
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3340
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Michael Vorburger
>            Assignee: Gary D. Gregory
>            Priority: Major
>             Fix For: 2.17.2
>
>
> I would like to see the warn log from {{LogManager}} re. which implementation 
> it picked, if multiple.
> I would like to be able to do this without a system property but using a 
> properties file on the classpath.
> StatusLogger's JavaDoc (currently) says that "This can be overridden via a 
> system property named #DEFAULT_STATUS_LISTENER_LEVEL and will work with any 
> Log4j provider.", where DEFAULT_STATUS_LISTENER_LEVEL is 
> "log4j2.StatusLogger.level".
> However that currently doesn't seem to quite work as advertised. (If you 
> think it does, please suggest how.) I can see some stuff in StatusLogger 
> related to its default log level been (only?) for StatusListener and 
> StatusData? This seems confusing.
> I'll raise a PR with a proposed simple fix for this for your review.
> [~ckozak] / [~ggregory]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to