When defining configuration file properties using file: URI notation (e.g., configurationFile for Log4j or Logback) on Windows, change backslashes \ to slashes / so the URI parses successfully.
tnt4j-log4j
In
config/log4j.properties, change the log appender tolog4j.appender.tnt4j=com.jkoolcloud.tnt4j.logger.log4j.TNT4JAppender.
Note that there should be a line likelog4j.appender.tnt4j=in this file, so please comment out or remove all others if present.In the
coremodule’spom.xml, change dependencies — uncomment:
<dependency>
<groupId>com.jkoolcloud.tnt4j.logger</groupId>
<artifactId>tnt4j-log4j</artifactId>
<version>0.4.1</version>
<scope>runtime</scope>
</dependency>- When running TNT4J-Streams, use the system property
-Dlog4j2.configurationFileto define thelog4j2.xmlfile location, e.g.:-Dlog4j2.configurationFile="./config/log4j2.xml".
tnt4j-logback
- Create the Logback configuration file:
config/logback.xml. In the
coremodule’spom.xml, change dependencies — uncomment:
<dependency>
<groupId>com.jkoolcloud.tnt4j.logger</groupId>
<artifactId>tnt4j-logback</artifactId>
<version>0.3.3</version>
<scope>runtime</scope>
</dependency>Comment out the Log4j dependencies.
When running TNT4J-Streams, use the system property
-Dlogback.configurationFileto define thelogback.xmlfile location, e.g.:-Dlogback.configurationFile="file:./config/logback.xml".Change the
bin/tnt-streams.batorbin/tnt-streams.shfile to pass the Logback configuration to Java:
BAT file:
set LOGBACKOPTS=-Dlogback.configurationFile="%RUNDIR%..\config\logback.xml" "%JAVA_HOME%\bin\java" %LOGBACKOPTS% %TNT4JOPTS% ...
SH file:
LOGBACKOPTS=-Dlogback.configurationFile="$RUNDIR/../config/logback.xml" "$JAVA_HOME/bin/java" $LOGBACKOPTS $TNT4JOPTS