In the EMA Java Developer Guide, it mentions that EMA Java can have underlying logging backend to be Java standard logger (java.util.logging), log4j, or other loggers implementing SLF4J logging interface. I want to use log4j logging framework with EMA Java, how to configure EMA Java to use log4j as the underlying logging backend?
Please note the log4j1 project reached end-of-life as of August 5, 2015.
EMA/Java uses SLF4J, there are simple drop in jars from each logging API that act as a binding to automatically connect to log4j2 or otherwise.
For log4j2, simply add the SLF4J API and binding to the class path:
log4j-api-2.0.jar:log4j-core-2.0.jar:log4j-slf4j-impl-2.0.jar:slf4j-api-1.7.12.jar
Capture the EMA output with the following in log4j2.xml:
<Logger name="com.thomsonreuters.ema.access" level="trace" additivity="false"> <AppenderRef ref="Console"/> </Logger>
For log4j1, use the matching jars per the SLF4J manual:
slf4j-log4j12-1.7.21.jar:slf4j-api-1.7.21.jar
For J.U.L., documented on the same page above:
slf4j-jdk14-1.7.21.jar:slf4j-api-1.7.21.jar
For Logback, a popular alternative to log4j1:
logback-classic-1.0.13.jar:logback-core-1.0.13.jar:slf4j-api-1.7.21.jar