You can specify whether JavaMail emits a protocol-level trace either when setting the Properties
for your Session
(by setting the "mail.debug"
property to "true"
) or by calling Session.setDebug
before you do the store connect.
However, when the Protocol
object gets instantiated, it creates a "protocol" TraceLogger
that persists for the lifetime of the protocol object. Which appears to mean that you can't temporarily disable protocol-level debug logging on a connection once you start using it.
There is a Protocol.suspendTracing
method. And it does allow you to temporarily turn off protocol trace output. A bunch of the IMAP auth methods use it to keep your credentials out of the logfile. But suspendTracing
is protected
, so it's not callable from regular user code.
Is there another way to temporarily turn off IMAP protocol tracing? (I'd prefer temporarily turning off just the traceInput
logging, but I'm fine with disabling all logging.) Do I need to write and register a whole Protocol subclass so I can get access to Protocol.suspendTracing
?