You should enable Log4j2 logger on both client and server side by adding the
following to the nodes’ configurations
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
...
<property name="gridLogger">
<bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
<constructor-arg type="java.lang.String"
value="config/ignite-log4j2.xml"/>
</bean>
</property>
...
</bean>
Path to log4j2 config may vary.
After that you need to use @LoggerResource annotation inside of your task to
avoid serialization/deserialization of client’s logger instance. Refer to
org.apache.ignite.resources.LoggerResource for more info.
—
Denis
> On Jun 29, 2016, at 12:57 PM, kcheng.mvp <[email protected]> wrote:
>
> Here is my configuration
>
> ------------ client node------------
>
> 1: IgniteBean
> <bean id="ignite" class="org.apache.ignite.IgniteSpringBean">
> <property name="configuration" ref="ignite.cfg"/>
> </bean>
>
> <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
> <property name="clientMode" value="true"/>
> <property name="peerClassLoadingEnabled" value="true"/>
> <property name="cacheConfiguration">
> <list>
>
> <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
> <property name="atomicityMode" value="ATOMIC"/>
> <property name="backups" value="1"/>
> </bean>
> </list>
> </property>
>
> 2: log4j2 dependency on the client node
>
> <dependency>
> <groupId>org.apache.ignite</groupId>
> <artifactId>ignite-core</artifactId>
> <version>${ignite.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.ignite</groupId>
> <artifactId>ignite-spring</artifactId>
> <version>${ignite.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.ignite</groupId>
> <artifactId>ignite-indexing</artifactId>
> <version>${ignite.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.ignite</groupId>
> <artifactId>ignite-log4j2</artifactId>
> <version>${ignite.version}</version>
> </dependency>
>
>
> ------------ server node------------
>
> 1: copy ${IGNITE_HOME}\libs\optional\ignite-log4j2 to ${IGNITE_HOME}\libs
>
>
>
> * issues*
> -----------------Execute below code from client node -------------
>
> *I can see the log from client node, but I can not see the log in the server
> node*
>
>
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
>
>
>
> private static final Logger logger =
> LogManager.getLogger(DecompilerService.class);
>
>
> public void dummyService() {
> ExecutorService exec = ignite.executorService();
> for (final String word : "aBCDEFG djdjdjdjdjdjdjdjd 11111111 Print
> words using runnable".split(" ")) {
> // Execute runnable on some node.
> exec.submit(new IgniteRunnable() {
> @Override
> public void run() {
> logger.info(">>> Printing '" + word + "' on this node
> from grid job.");
> }
> });
> }
> }
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/log4j-on-server-node-log-no-print-tp5988.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.