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

Simon Ziller commented on LOG4J2-3192:
--------------------------------------

I tested with the existing unit test 
"org.apache.logging.log4j.core.config.properties.PropertiesConfigurationTest#testPropertiesConfiguration"
 and attached a loop at the end, so that I can change the configuration 
"target/test-classes/log4j2-properties.properties" manually. The 
monitorInterval was set to 1. This test works fine.

Then I created a main method in this class to run it without junit as normal 
java application with the same log4j configuration file.
{code:java}
public static void main(final String[] args) {
    System.setProperty("log4j2.configurationFile", 
"file:D:/prj/log4j2x/log4j-core/target/test-classes/log4j2-properties.properties");
    final Logger logger = 
LogManager.getLogger(PropertiesConfigurationTest.class);
    logger.info("Starting logging loop for 30 runs");

    for (int i = 0; i < 30; i++) {
        logger.info("this is info  " + i);
        logger.debug("this is debug " + i);

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    System.exit(0);
} {code}
The "log4j2.configurationFile" configuration was tested as vm argument and like 
the code snipped above.
Both variants didn't work.

So it seems that the log4j configuration is handled in a different way between 
unit test and main method.

> log4j2.properties: monitorInterval has no effect since 2.13.2
> -------------------------------------------------------------
>
>                 Key: LOG4J2-3192
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3192
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.14.1
>            Reporter: Simon Ziller
>            Assignee: Ralph Goers
>            Priority: Major
>         Attachments: Log4j2Test.zip
>
>
> "Properties configuration files support the advertiser, monitorInterval, 
> name, packages, shutdownHook, status, and verbose attrbutes." source: 
> [https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties]
> But adding "monitorInterval=5" to log4j2.properties seems to have no effect. 
> Changes to log4j2.properties do not change the configuration.
> This Problem was already solved with LOG4J2-1263.
> Since the feature was not working with the latest version 2.14.1, I tried 
> older versions. The Version 2.13.1 is the last one where monitorInterval is 
> working in a property file configuration.



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

Reply via email to