logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurent Hasson <...@CapsicoHealth.com>
Subject Flushing async appenders
Date Thu, 23 Nov 2017 14:42:12 GMT
Hello all,

I have the following configuration file using async appenders. It works well but I have one
issue. During low-volume activity on my site, it seems that nothing is output to the file,
so it's hard to see what's going on. Same issue happens while developing. But as soon as enough
activity occurs, then the logs are flushed to the file as expected. I suspect there is a buffer
somewhere that only gets flushed when it's full, and so during low activity, that may take
a while. Is there a way to control that so that flushing happens more often, wither by sizing
the buffer to be smaller, or maybe some timeout value, i.e., flush at least once every 5s?

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">
      <Properties>
            <Property name="log-path">C:\Projects\TomcatDevServer\logs\</Property>
            <Property name="now">${sys:startup}</Property>
      </Properties>
      <Appenders>
            <RollingFile name="FILES" fileName="${log-path}/loga.log" filePattern="${log-path}/logs.${now}.%i.log.gz">
                  <PatternLayout>
                <pattern>%d{MMdd.HHmmss.SSS}#%-3t %level{length=1} %15.15c{1}|  %m%ex{20}%n</pattern>
                  </PatternLayout>
                  <Policies>
                        <SizeBasedTriggeringPolicy size="100 MB" />
                  </Policies>
                  <DefaultRolloverStrategy max="99999" compressionLevel="6"/>
            </RollingFile>
            <Async name="ASYNC">
                  <AppenderRef ref="FILES" />
            </Async>
      </Appenders>
      <Loggers>
            <Root level="debug">
                 <AppenderRef ref="ASYNC" />
            </Root>
      </Loggers>
</Configuration>


Thank you,


Laurent Hasson



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message