[ 
https://issues.apache.org/jira/browse/LOG4J2-911?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Gregory updated LOG4J2-911:
--------------------------------
    Summary: monitorInterval is not honored for XInclude hrefs  (was: 
monitorInterval is not honored when using XInclude)

> monitorInterval is not honored for XInclude hrefs
> -------------------------------------------------
>
>                 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 stumbled upon the following scenario:
> I have created a configuration file which uses monitorInterval=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 local files. This servlet runs 
> fine and prints the xml fragments correctly.
> 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 level=trace, and it effectively 
> registers the reload 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:
> {code:xml}
> <?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>
> {code}
> Appenders fragment:
> {code:xml}
> <?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>
> {code}
> Loggers fragment:
> {code:xml}
> <?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>
> {code}
> Thanks a lot



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to