logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin F. López (JIRA) <j...@apache.org>
Subject [jira] [Created] (LOG4J2-911) monitorInterval is not honored when using xinclude
Date Mon, 01 Dec 2014 22:08:13 GMT
Edwin F. López created LOG4J2-911:
-------------------------------------

             Summary: monitorInterval is not honored when using xinclude
                 Key: LOG4J2-911
                 URL: https://issues.apache.org/jira/browse/LOG4J2-911
             Project: Log4j 2
          Issue Type: Bug
          Components: Configurators
    Affects Versions: 2.1
         Environment: Windows, Linux
            Reporter: Edwin F. López
            Priority: Critical


Hi there.
I'm using Log4J2 version 2.1 and while doing a proof of concept for centralizing my configurations,
I have stumble upon the following scenario:

I have created a configuration file which should be reloading automatically every 15 seconds
in a console application. For loading the appenders and loggers, I have used the XInclude
directive to reference the external source information, however, I'm using a servlet to generate
the xml instead of files. This servlet runs fine and correctly prints the xml fragments.

Well, it happens that the configuration only reloads when the log4j2.xml file changes, however,
if there is any change in the output from the servlet, it doesn't reload the new configuration.
In other words, I was expecting that the configuration was getting reloaded every 15 seconds,
so it could take the new values from the servlet but it is not happening.

I have activated the statuslogger to a trace level, and it effectively registers the configuration
reloading when manually modifying the log4j2.xml, but it never shows anything when the xinclude
values changes.

Is this the expected behavior? I was expecting a reconfiguration every 15 secs.

See below the log4j2.xml and appenders.xml and loggers.xml

Log4J2 config file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Configuration
    xmlns:xi="http://www.w3.org/2001/XInclude"
    name="Log4J2Config"
    monitorInterval="10"
    status="Trace">
    <Properties>
        <Property name="Pattern">%d{ISO8601}|APP=%marker|%p|%c|%M|%m%n</Property>
    </Properties>

    <!-- Appenders -->
    <xi:include href="http://localhost:7001/log4j2config/getlog4j2xmlconfig?appCode=log4jConfig&amp;section=appenders"
/>

    <!-- Loggers -->
    <xi:include href="http://localhost:7001/log4j2config/getlog4j2xmlconfig?appCode=log4jConfig&amp;section=loggers"
/>
</Configuration>

Appenders fragment:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Appenders>
    <Console name="Console" target="SYSTEM_ERR">
        <PatternLayout pattern="${Pattern}"/>
    </Console>

    <RollingFile
        name="RollingFile"
        fileName="app.log"
        filePattern="app-%d{yyyyMMdd}-%i.log.gz">

        <PatternLayout pattern="${Pattern}" />

        <Policies>
            <SizeBasedTriggeringPolicy size="1MB" />
        </Policies>

    </RollingFile>
</Appenders>

Loggers fragment:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Loggers>
    <Root level="Off">
        <AppenderRef ref="Console" />
    </Root>
    <Logger name="log4jconfig.Log4JConfig" level="FATAL" includeLocation="true">
        <AppenderRef ref="RollingFile" />
    </Logger>
</Loggers>

Thanks a lot



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message