log4j, Mondrian MDX and SQL Logging
I’ve always struggled to get log4j working perfectly within the Pentaho BI Platform. Before the release of JBoss 4.2.1, there was a log4j.xml conflict between JBoss’s config and regular web applications. Now that Pentaho 1.7 PCI by default runs in JBoss 4.2.1, we finally have a hastle free way to manage logging.
We can now manage all of Pentaho’s logging within the pentaho war’s WEB-INF/classes/log4j.xml file. Another reason why this is important to note is that Mondrian’s SQL and MDX logging, something we’re always taking a look at, moved from a Mondrian debug property to a log4j category in Mondrian 3.0. To get MDX and SQL logging out of Mondrian:
Add two new categories to the log4j.xml file:
<category name="mondrian.sql">
<priority value="DEBUG"/>
</category>
<category name="mondrian.mdx">
<priority value="DEBUG"/>
</category>
Also, you’ll want to remove the explicit Threshold element from within the appenders. When a Threshold is defined in an Appender, it overrides the individual category thresholds. log4j is a powerful logging tool, but sometimes it can be difficult to configure.