Mule ESB: Are the Log4j Config for Batch in Mule need separate configuration?

≡放荡痞女 提交于 2019-12-11 22:50:13

问题


I have log4j config file, it seems to be working for normal flows, but when comes to batch it is not working, not sure what has to added in config file in specific to batch. Please help on this issue

<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>

Blog i have found like this log4j.logger.com.mulesoft.module.batch=INFO. I'm not sure what all the config specific for batch has to be added in above xml. Are we have any special config for Batch in Log4j Mule ESB? I'm not sure how to be executed for batch. Thanks in advance.


回答1:


Try the following in your 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>

Change the path :- <param name="File" value="C:/Users/Logs.log" /> according to your requirement .. This path is where the log file will be generated



来源:https://stackoverflow.com/questions/25828634/mule-esb-are-the-log4j-config-for-batch-in-mule-need-separate-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!