I have gotten this to work where the IGNITE appender is being used for Ignite
logs. However, I am having a lot of issues related to ActLogAppender, which is
a custom appender, working with Ignite. If I set the gridLogger to use
Log4J2Logger at all, I continually see:
2020-02-14 13:25:19,199 INFO STDERR [Thread-2] {} 2020-02-14 13:25:19,197
Log4j2-TF-3-AsyncLoggerConfig-2 ERROR Attempted to append to non-started
appender ActLogAppender
I have verified that the appender is started before I see this issue. This log
line is written at the beginning of the log file, overwriting the initial log
statements. This makes me think that there are two separate loggers or
appenders. Either way, this does not work as expected when integrating with
Ignite. Any advice/ideas would be appreciated, as I would like to set Ignite's
log level to INFO, but can't due to errors with custom appender.
From: [email protected] At: 02/13/20 19:24:11To: [email protected]
Cc: Anant Narayan (BLOOMBERG/ 731 LEX ) , Ranjith Lingamaneni (BLOOMBERG/ 731
LEX )
Subject: 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"?