Mule ESB:Mule中的Log4j配置是否需要单独配置?

时间:2014-09-13 23:14:02

标签: mule mule-studio mule-el mule-component

我有log4j配置文件,它似乎适用于普通流程,但是当批量处理它不起作用时,不确定在配置文件中添加了哪些特定批处理。请帮助解决这个问题

<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="C:\Users\Logs.log" />
............
<layout class="org.apache.log4j.PatternLayout">    
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
    <param name="LevelMin" value="INFO" />
    <param name="LevelMax" value="FATAL" />
    <param name="AcceptOnMatch" value="true" />
</filter>
<root>
<appender-ref ref="FILE" />
</root>

博客我发现像 log4j.logger.com.mulesoft.module.batch = INFO 。我不确定在上面的xml中必须添加特定于批处理的所有配置。 我们在Log4j Mule ESB中有批量的特殊配置吗? 我不确定如何批量执行。 提前谢谢。

1 个答案:

答案 0 :(得分:0)

在log4j.xml中尝试以下操作: -

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
    <appender name="rolling-out" class="org.apache.log4j.RollingFileAppender">
        <param name="Threshold" value="info" />
        <param name="File" value="C:/Users/Logs.log" />
        <param name="Append" value="true" />
        <param name="MaxFileSize" value="10000KB" />
        <param name="MaxBackupIndex" value="3" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="[%d] [%-5p] [%t] %m%n"/>
        </layout>
    </appender> 

    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <param name="Threshold" value="info" />
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="[%d] [%-5p] [%t] %m%n"/>
        </layout>
    </appender>

    <logger name="log4j.logger.com.gigaspaces"> 
        <level value="ERROR" /> 
        <appender-ref ref="rolling-out" />
    </logger>

        <logger name="log4j.logger.com.j_spaces">           
        <level value="ERROR" /> 
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.com.sun.jini">           
        <level value="ERROR" /> 
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.net.jini">           
        <level value="ERROR" /> 
        <appender-ref ref="rolling-out" />
    </logger>


    <logger name="log4j.logger.org.mule">           
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.org.mulesoft">           
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.org.apache.cxf">     
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.org.apache">     
        <appender-ref ref="rolling-out" />
    </logger>

    <logger name="log4j.logger.org.springframework.beans.factory">          
        <appender-ref ref="rolling-out" />
    </logger>

    <root>
        <level value="INFO" />
        <appender-ref ref="rolling-out" />      
        <appender-ref ref="CONSOLE" />
    </root> 

</log4j:configuration>

根据您的要求更改路径: - <param name="File" value="C:/Users/Logs.log" /> ..此路径是生成日志文件的位置