logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hasan Topcu <hsntp...@gmail.com>
Subject Async logging
Date Mon, 03 May 2021 20:26:09 GMT
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>

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