Async logging

Hasan Topcu <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAOPYGxmTDiEK9-6RtKgbmeX9RO5=aPqoxzWzgXVTc3a6Q5bHTw@mail.gmail.com>
Hi,

It looks like asynchronous logger configuration is set to flush ~ every 3
minutes. But current configuration makes it difficult to troubleshoot
issues.


Is there a way of changing the log flush interval to a more sensitive one
like 3-5 seconds ?


It says that "Async Loggers will auto-flush in batches, so switch off
immediateFlush when using the async logger" , not sure still if I need to
change the " immediateFlush=true" ?



Thanks


Here is the config we use :

<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60" status="debug">
    <Properties>
        <Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} %p
%c{1.}.%M NT:%N [%t]  %m %ex%n</Property>
        <Property
name="LOG_FILEPATH">${sys:LOG_FOLDER:-logs}/${sys:SERVICE_NAME:-service}.log</Property>
    </Properties>
    <Appenders>
        <Console name="Console-Appender" target="SYSTEM_OUT">
            <PatternLayout>
                <Pattern>${LOG_PATTERN}</Pattern>>
            </PatternLayout>
        </Console>
        <!-- Rollover log file every day or when log file reaches 100MB. -->
        <!-- Caution: changing the filePattern changes the meaning of the
time interval. -->
        <!-- Async Loggers will auto-flush in batches, so switch off
immediateFlush when using the async logger. -->
        <RollingRandomAccessFile name="RollingRandomAccessFile-Appender"
append="true" immediateFlush="false" fileName="${LOG_FILEPATH}"
filePattern="${sys:LOG_FOLDER:-logs}/$${date:yyyy-MM}/${sys:SERVICE_NAME:-service}-%d{yyyy-MM-dd}-%i.log.gz">
            <PatternLayout>
                <Pattern>${LOG_PATTERN}</Pattern>>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"
maxRandomDelay="120"/>
                <SizeBasedTriggeringPolicy size="100 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="99"/>
        </RollingRandomAccessFile>
    </Appenders>
    <Loggers>
        <Logger name="org.apache.http" level="info" includeLocation="true"/>
        <Logger name="org.apache.http.wire" level="info"
includeLocation="true"/>
        <Logger name="com.five9" level="debug" includeLocation="true"/>
        <Logger name="com.sync" level="debug" includeLocation="true"/>
        <Root level="debug">
            <!-- Minimize what is logged to the console since log messages
also go to the RollingFile log. -->
            <AppenderRef ref="Console-Appender" level="warn"/>
            <AppenderRef ref="RollingRandomAccessFile-Appender"/>
        </Root>
    </Loggers>
</Configuration>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.