About Me

My Photo
I am a Software Architect and Developer based in Bangalore, India. I have experience in building (scalable) applications using Java, JSP, JSF, JBoss Drools, Spring Framework, Hibernate, Ajax, JavaScript, MySQL, NoSQL (HBase, Project Voldemort). I am also a fan of Ruby on Rails, and have done some experimental work with it.

Saturday, August 06, 2011

Using your own log4j.properties with GridGain

By default, GridGain comes with its own copy of log4j configuration in the form of "default-log4j.xml" GridGain does not allow usage of log4j.properties as GridLog4jLogger only accepts XML file as source of configuration.

However, like me, if you are adding GridGain to an application that has logging already configured using log4j.properties, then, you can use below workaround.

In the below example, we are setting gridLogger property of Grid Configuration by using an
instance of GridLogger that is constructed using a regular log4j Logger object.

Then, we have log4jInitialization bean that initialzes log4j using
log4j.properties with the help of org.springframework.util.Log4jConfigurer.

0 comments: