Issue with Ignite Logging and Log4j2

classic Classic list List threaded Threaded
2 messages Options
Mitchell Rathbun (BLOOMBERG/ 731 LEX) Mitchell Rathbun (BLOOMBERG/ 731 LEX)
Reply | Threaded
Open this post in threaded view
|

Issue with Ignite Logging and Log4j2

I am hoping to use a separate appender for Ignite logs in my application. In my configuration file, I have:

<asyncLogger name="org.apache.ignite" level="info" additivity="false">
<appender-ref ref="IGNITE"/>
</asyncLogger>
<asyncRoot level="info">
<appender-ref ref="MAIN"/>
<appender-ref ref="ActLogAppender" level="ERROR"/>
</asyncRoot>

IGNITE and MAIN are both RollingRandomAccessFile appenders pointing to different files. In my java code I have:

File logConfigFile = new File(config.getIgniteGridLoggerXmlPath());
try {
IgniteLogger logger = new Log4J2Logger(logConfigFile);
ignCfg.setGridLogger(logger);
} catch (IgniteCheckedException e) {
LOG.error("Unable to set up IgniteLogger with path {}", logConfigFile, e);
}

When I run my application, Ignite is still sending all of its logs to the same file that MAIN points to. Any idea why this doesn't work? Should the name for the logger be something different than "org.apache.ignite"?
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Ignite Logging and Log4j2

Hello!

Do you actually have this IGNITE appender? Also, I think this config will lead to duplication of log lines instead of redirection.

Better ask somewhere with log4j expertise.

Regards,
--
Ilya Kasnacheev


пт, 14 февр. 2020 г. в 03:24, Mitchell Rathbun (BLOOMBERG/ 731 LEX) <[hidden email]>:
I am hoping to use a separate appender for Ignite logs in my application. In my configuration file, I have:

<asyncLogger name="org.apache.ignite" level="info" additivity="false">
<appender-ref ref="IGNITE"/>
</asyncLogger>
<asyncRoot level="info">
<appender-ref ref="MAIN"/>
<appender-ref ref="ActLogAppender" level="ERROR"/>
</asyncRoot>

IGNITE and MAIN are both RollingRandomAccessFile appenders pointing to different files. In my java code I have:

File logConfigFile = new File(config.getIgniteGridLoggerXmlPath());
try {
IgniteLogger logger = new Log4J2Logger(logConfigFile);
ignCfg.setGridLogger(logger);
} catch (IgniteCheckedException e) {
LOG.error("Unable to set up IgniteLogger with path {}", logConfigFile, e);
}

When I run my application, Ignite is still sending all of its logs to the same file that MAIN points to. Any idea why this doesn't work? Should the name for the logger be something different than "org.apache.ignite"?