MULE-摆脱“记录器是用消息工厂创建的...现在是用消息工厂请求的...”

时间:2018-08-31 14:19:26

标签: mule log4j2

我在使用log4j2和Mule Runtime 3.9时遇到一些不便,我的日志充满了这样的警告:

2018-08-30 09:25:04,144 HTTP_Listener_Configuration.worker.01 WARN The Logger xxxxxxxxxxx was created with the message factory org.apache.logging.log4j.message.ParameterizedMessageFactory@27e54dd3 and is now requested with the message factory org.apache.logging.log4j.message.ParameterizedMessageFactory@125d22d, which may create log events with unexpected formatting.

我的类(变压器)中的用法模式非常简单:

import lombok.extern.log4j.Log4j2;
@Log4j2
public class NativeWorkOrderNbap2CDMTransformer extends AbstractMessageTransformer {...}

Lombok在这里只是生成如下代码:

private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LogExample.class);

所以没有什么特别的通常的模式。 Log4j2的配置文件也非常简单:

<Configuration>
    <Appenders>
        <RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}shift_esb.log" filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}shift_esb-%i.log">
            <PatternLayout pattern="%d [%-5p] [%c] [%X{tag}] %m%n" />
            <SizeBasedTriggeringPolicy size="50 MB" />
            <DefaultRolloverStrategy max="10" />
        </RollingFile>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d [%-5p] [%c] [%X{tag}] %m%n" />
        </Console>
    </Appenders>
    <Loggers>
        <AsyncLogger name="org.apache" level="INFO" />
        <AsyncLogger name="org.springframework" level="WARN" />
        <AsyncRoot level="TRACE">
            <AppenderRef ref="file" />
            <AppenderRef ref="console" />
        </AsyncRoot>
    </Loggers>
</Configuration>

所以我很困惑为什么log4j2抱怨不同的工厂。是否有一些特殊的方法可以在Log子中获取Logger实例?

0 个答案:

没有答案