如何使用Mule studio Eclipse插件更改日志记录级别

时间:2013-11-06 09:28:43

标签: eclipse logging mule mule-studio

Mule studio从...eclipse\plugins\org.mule.tooling.server.3.3.1_1.3.2.201212121943\mule\tooling\tooling-support-3.3.1.jar加载log4j属性文件,而不是项目根文件夹中提供的文件。

2 个答案:

答案 0 :(得分:2)

log4j.properties应位于src/main/resources,而不是根文件夹中。您可以使用jar中的log4j.properties文件作为模板,并使用log4j.rootCategory=DESIREDLEVEL, console更改日志记录级别:

# Default log level
log4j.rootCategory=INFO, console

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %d [%t] %c: %m%n

################################################
# You can set custom log levels per-package here
################################################

# Apache Commons tend to make a lot of noise which can clutter the log.
log4j.logger.org.apache=WARN

# Shuts up some innocuous messages if using the JBPM transport
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR

# Reduce startup noise
log4j.logger.org.springframework.beans.factory=WARN

# Mule classes
log4j.logger.org.mule=INFO

# Your custom classes
log4j.logger.com.mycompany=DEBUG

答案 1 :(得分:1)

我发现了一篇帮助我在Mule ESB 3.6中解决这个问题的文章。这个Mulesoft版本使用log4j2并查找如下配置:

  

部署应用程序时,Mule将查找以下配置   像孩子这样的第一种模式:

Look for a file called log4j2-test.xml in the application classpath
Look for a file called log4j2.xml in the application classpath
Look for a file called log4j2-test.xml in the domain classpath
Look for a file called log4j2.xml in the domain classpath
Look for a file called log4j2-test.xml in MULE_HOME/conf
Look for a file called log4j2.xml in MULE_HOME/conf
Apply default configuration.

将logj2.xml放在classpath上,即在src / main / resources中。它有效。

链接到文章: http://blogs.mulesoft.org/mule-3-6-asynchronous-logging/