How to enable logging for Maverick Legacy APIs

Lee Painter

The Maverick Legacy APIs (both client and server) use SLF4J logging. SLF4J is just a logging facade that supports several different types of logging frameworks. Wrappers are available for AVSL, JDK14, Log4J, Logback and Simple (to System.err). It should also be possible to add your own wrapper if you use a custom logging system.

Unlike previous versions of our API, no special debug jar file is required. Use the standard jars and include the SLF4J dependencies from our lib folder. We provide the wrapper for Log4J in our lib folder, slf4j-log4j12-1.7.2.jar. If you want to use a different logging framework then you need to omit this jar file and replace with the relevant wrapper jar from SLF4J website. 

Using Maverick SLF4J

The preferred logging mechanism from version 1.7.33 onwards is the maverick-slf4j logging provider. This supports the new logging provider developed by JADAPTIVE Limited for the Maverick Synergy API. 

To use this logging provider ensure you have no other SLF4j provider in your classpath, include slf4j-api-<version>.jar from our lib folder and maverick-slf4j-<version>.jar from our optional dependencies. 

The configuration of this provider can be found under our Maverick Synergy API documentation. The options are all identical to those provided by Maverick Synergy although currently, we have not implemented connection-level logging. We hope to implement this in a future release.

Using Log4J

To configure log4j we use:

org.apache.log4j.PropertyConfigurator.configure("log4j.properties");

with log4j.properties file containing

# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=DEBUG,CONSOLE,LOGFILE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %x - %m%n

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=maverick.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %x - %m%n