How to enable debug logs for Maverick versions 1.4.x

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

For J2SSH Maverick our client API

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));

 

For Maverick SSHD our server API

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

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

DaemonContext.addEventListener(new SSHDLoggingListener());

 

Then for both products do the following

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

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.