Latest Entries »

Thursday, August 25, 2011

Mondrian Logging and Tracing

I have been trying to write up this post for quite sometime now. But lately things have been so busy that I could not find time. So here it is for a lot of folks who have faced trouble setting up Logging and Tracing with Mondrian. Below are the steps to configure Logging and Tracing in Mondrian.

Prerequisite
The below are not the bare minimum but is a tested configuration on my server.
  1. Apache Tomcat >= 6
  2. Mondiran >= 3.2
Configuring Environmental Variables
While setting up Mondrian we understand that we have to setup CATALINA_OPTS as an environmental variable. For successfully setting up Logging and Tracing, we need to have 2 more declaratives added to the end as below:-



Adding the above in .bashrc in CATALINA_OPTS env variable allows you to do the following:-
  • Adding log4j.xml file allows tomcat to pick up the logging configuration from your webapps/mondrian/WEB-INF/classes/log4j.xml. (Sample file is present in the section below)
  • Adding log.dir allows you to specify where you want your log files to be generated.

Configure Log4J
Below is the sample file for Log4j configuration. Place this file in webapps/mondrian/WEB-INF/classes/ 



Restart and Test Using JPivot

Now the environment variables are set and the logging configuration is done as well. Now follow the below steps to generate log files:-
  1. Restart Mondrian
  2. Now we can run the MDX queries in JPivot interface and we can see that the log files would be generated in the directory specified in log.dir variable. The log files that are generated from the above log4j configuration is as follows:-
    • mdx.log - Contains all the MDX statements executed
    • sql.log - Contains all the SQL statements executed by mondrian on native database.
    • mondrian.log - Contains the entire mondrian flows including the hierarchies, sql, mdx statements etc.
     
There you go friends!!! Post in your comments if there are any doubts.

2 comments:

Janardhan said...

Hi,

Very useful, if I'm using Mondrian API in my own application, how do I enable Logging


Many Thanks in advance
Janardhan

Unknown said...

Janardhan,

Sorry for the delayed reply. If you are using Mondrian API in your application.. I am assuming you mean Olap4J. You should be able to configure your local Log4J for what queries you are throwing but mondrian logging would need to be enabled on Mondrian server only.