You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Laurent Hasson <ld...@CapsicoHealth.com> on 2017/11/23 14:37:52 UTC
Async Loggers Vs. Async Appenders
I saw on the log4j site (https://logging.apache.org/log4j/2.x/manual/async.html) that async loggers were preferred performance-wise to async appenders. It describes a way to get async loggers through system properties, but I as trying to get that done through the configuration file. I tried the following, but do not get any logs output.
<?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>
</Appenders>
<Loggers>
<AsyncLogger level="debug">
<AppenderRef ref="FILES" />
</AsyncLogger>
</Loggers>
</Configuration>
Any idea what I am doing wrong?
Thank you.
Laurent Hasson
Re: Async Loggers Vs. Async Appenders
Posted by Ralph Goers <ra...@dslextreme.com>.
It seems you are trying to create an asynchronous root logger. For that you need to use AsyncRoot, not AsyncLogger.
Ralph
> On Nov 23, 2017, at 7:37 AM, Laurent Hasson <ld...@CapsicoHealth.com> wrote:
>
>
> I saw on the log4j site (https://logging.apache.org/log4j/2.x/manual/async.html) that async loggers were preferred performance-wise to async appenders. It describes a way to get async loggers through system properties, but I as trying to get that done through the configuration file. I tried the following, but do not get any logs output.
>
> <?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>
> </Appenders>
> <Loggers>
> <AsyncLogger level="debug">
> <AppenderRef ref="FILES" />
> </AsyncLogger>
> </Loggers>
> </Configuration>
>
>
> Any idea what I am doing wrong?
>
> Thank you.
>
>
> Laurent Hasson
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org