While I don’t see anything technically wrong with your configuration you could 
probably simplify it. If all statistics are produced using the 
com.myapp.EventStatistics logger you can add additivity=“false” to that logger 
to prevent the events form also being handled by the root logger. I would 
presume you could then remove the statistics filters.

What OS is this running on and what version of Log4j?  I assume you have 
checked stdout/stderr for any messages that might be printed by Log4j?

Ralph

> On Oct 1, 2018, at 4:32 PM, Skye Antinozzi <antin...@morris.umn.edu> wrote:
> 
> Hello!
> 
> We are using a RollingRandomAccessFile appender with a 5 minute cron
> rollover schedule. On rare occasion logs stop being output after rolling
> and seem to not recover until the application restarts.
> 
> We run with a somewhat complicated log configuration, using the following:
> * Async appender
> * Marker filters
> * Name filters
> * Multiple log files
> * JSON output
> * cron rollover schedule
> 
> We use log markers to filter our messages out to their own file. We use a
> log name filter to filter a statistics class to its own file.
> 
> We run our application(s) daily and quite constantly, yet, the problem
> seems to occur anywhere from multiple times a day to spanning a few days
> between occurrences. When the problem does occur, it seems that it can be
> corrected upon restarting the application.
> 
> Here is our log4j2.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="INFO">
> <Properties>
> <Property name="cronRolloverSchedule">0 */5 * * * ?</Property>
> <Property name="logDir">./logs</Property>
> <Property name="rolloverLogDir">./logs_backup</Property>
> <Property name="logPattern">%d{ISO8601}{UTC}Z %-5level [%thread] %logger -
> %message%n</Property>
> <Property name="messagePattern">%d{ISO8601}{UTC}Z %message%n</Property>
> </Properties>
> <Appenders>
> <RollingRandomAccessFile
> name="Main"
> fileName="${logDir}/myapp.json.log"
> filePattern="${rolloverLogDir}/myapp.json.log.%d{yyyy-MM-dd_HHmm}{UTC}Z">
> <JsonLayout
> properties="true"
> complete="true" />
> <Policies>
> <CronTriggeringPolicy
> schedule="${cronRolloverSchedule}"
> evaluateOnStartup="true" />
> </Policies>
> </RollingRandomAccessFile>
> <RollingRandomAccessFile
> name="Statistics"
> fileName="${logDir}/myapp.stats.json.log"
> filePattern="${rolloverLogDir}/myapp.stats.json.log.%d{yyyy-MM-dd_HHmm}{UTC}Z">
> <JsonLayout
> properties="true"
> complete="true" />
> <Policies>
> <CronTriggeringPolicy
> schedule="${cronRolloverSchedule}"
> evaluateOnStartup="true" />
> </Policies>
> </RollingRandomAccessFile>
> <RollingRandomAccessFile
> name="Message"
> fileName="${logDir}/myapp-messages.json.log"
> filePattern="${rolloverLogDir}/myapp-messages.json.log.%d{yyyy-MM-dd_HHmm}{UTC}Z">
> <JsonLayout
> properties="true"
> complete="true" />
> <Policies>
> <CronTriggeringPolicy
> schedule="${cronRolloverSchedule}"
> evaluateOnStartup="true" />
> </Policies>
> </RollingRandomAccessFile>
> </Appenders>
> <Loggers>
> <AsyncRoot level="trace">
> <AppenderRef ref="Main">
> <Filters>
> <MarkerFilter
> marker="MESSAGE"
> onMatch="DENY"
> onMismatch="NEUTRAL" />
> <MarkerFilter
> marker="EVENT_STATISTICS"
> onMatch="DENY"
> onMismatch="NEUTRAL" />
> </Filters>
> </AppenderRef>
> <AppenderRef ref="Message">
> <Filters>
> <MarkerFilter
> marker="MESSAGE"
> onMatch="ACCEPT"
> onMismatch="DENY" />
> <MarkerFilter
> marker="EVENT_STATISTICS"
> onMatch="DENY"
> onMismatch="NEUTRAL" />
> </Filters>
> </AppenderRef>
> </AsyncRoot>
> <AsyncLogger
> name="com.myapp.EventStatistics"
> level="INFO">
> <AppenderRef ref="Statistics" />
> </AsyncLogger>
> </Loggers>
> </Configuration>
> 
> Thanks for the help!
> 
> - Skye



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to