Chapter 9. Logging
Logging is important in troubleshooting and debugging. protonJ2 uses slf4j as its logger for full configuration options see Slf4j Manual.
9.1. Configuring a simple logger with slf4j Copy linkLink copied to clipboard!
To configure a simple logger using slf4j create a file `simplelogger.properties and configure like so:
Example Simple Logger
org.slf4j.simpleLogger.logFile=System.out
org.slf4j.simpleLogger.defaultLogLevel=warn
org.slf4j.simpleLogger.showDateTime=true
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss,SSS
org.slf4j.simpleLogger.log.org.apache.qpid.protonj2=warn
org.slf4j.simpleLogger.log.org.apache.qpid.protonj2.client=warn
9.2. Enabling protocol logging Copy linkLink copied to clipboard!
The following code writes AMQP frames to the console.
Example: Logging AMQP frames
ConnectionOptions options = new ConnectionOptions();
options.traceFrames(true);
Alternatively you get set the environment variable PN_TRACE_FRM to true;