How to configure logging for version 1.4

Lee Painter

Maverick 1.4 uses commons logging, you can enable it using a tool such as log4j.

Ensure you are using maverick-all-debug.jar instead of maverick-all.jar.

Ensure that the following statement is in your code before you use the API to ensure events are logged to commons logging.

SshConnector.addEventListener(new J2SSHLoggingListener(false)); 

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