log4j2异步appender仅适用于调试级别

时间:2017-02-22 01:19:57

标签: log4j2 asyncappender

我有一个Async appender只有在我设置level = debug时才有效。对于"错误"它没有记录任何东西。

select hashtag 
from dynamictable
where id = (
            select min(d.id) 
            from dynamictable d 
            inner join referencetable r on r.hashtag = v.hashtag
           )

我不确定此配置中缺少的是什么。这是我尝试使用的自定义appender

select top 1 d.hashtag
from dynamictable d 
inner join referencetable r on r.hashtag = d.hashtag
order by v.id

}

1 个答案:

答案 0 :(得分:0)

尝试以下

<Configuration packages="com.custom.appender">
    <Appenders>
        <Async name="customAsync" bufferSize="2" includeLocation="flase">
            <AppenderRef ref="customConsoleLogger"/>
        </Async>
        <Console name="customConsoleLogger" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
    </Appenders>

    <Loggers>
        <Logger name="com.mypackage" level="INFO">
            <AppenderRef ref="customAsync"/>
        </Logger>
    </Loggers>
</Configuration>