Created
August 2, 2011 15:39
-
-
Save srikanthps/1120462 to your computer and use it in GitHub Desktop.
How to configure GridGain Logging using log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sample grid-config.xml shows how to configure GridGain Logging | |
using log4j.properties. This is needed when you are integrating GridGain | |
in an legacy app that use log4j.propreties for log4j configuration, | |
whereas GridGain uses log4j.xml. | |
In the above example, we are setting gridLogger property by using an | |
instance of GridLogger which 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans | |
xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:util="http://www.springframework.org/schema/util" | |
xsi:schemaLocation=" | |
http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd | |
http://www.springframework.org/schema/util | |
http://www.springframework.org/schema/util/spring-util-2.5.xsd"> | |
<bean id="grid.cfg" | |
class="org.gridgain.grid.GridConfigurationAdapter" | |
scope="singleton"> | |
<property name="gridLogger"> | |
<bean | |
class="org.gridgain.grid.logger.log4j.GridLog4jLogger"> | |
<constructor-arg ref="log4jLogger" /> | |
</bean> | |
</property> | |
</bean> | |
<bean name="log4jLogger" class="org.apache.log4j.Logger" | |
factory-method="getRootLogger"></bean> | |
<bean id="log4jInitialization" | |
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> | |
<property name="targetClass" | |
value="org.springframework.util.Log4jConfigurer" /> | |
<property name="targetMethod" | |
value="initLogging" /> | |
<property name="arguments"> | |
<list> | |
<value>classpath:log4j.properties</value> | |
</list> | |
</property> | |
</bean> | |
</beans> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment