mail-api
mail-api copied to clipboard
enable changing log level on a per-connection basis
There does not appear to be a way to change the log level or to suspend debug tracing for a single client connection. There are a few workarounds for this, like writing a custom toggleable PrintStream and passing it to Session.setDebugOut(), but it seems like it'd be significantly cleaner to have a Store API (or something similar).
There is a Protocol.suspendTracing method which temporarily turns off protocol trace output, but it's not visible by user code.
Affected Versions
1.5.3
Environment
Macintosh Mac OS
- Issue Imported From: https://github.com/javaee/javamail/issues/161
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @bshannon
@glassfishrobot Commented @bshannon said: Logging is done by many classes at many levels. They all use a MailLogger class, which can log to both the Session's debug stream, and to java.util.logging. The Session's debug stream and flag are captured when the MailLogger is created, which is typically when the class that uses it is instantiated. This doesn't allow for an easy way to control logging based on a Store-level flag.
The workaround you suggest is significantly simpler than the alternatives in JavaMail itself.
I'm most likely going to close this as "won't fix".
@glassfishrobot Commented Jason-Mehrens said: The SO thread for this is:
http://stackoverflow.com/questions/30201743/how-to-temporarily-disable-protocol-tracing-during-a-javamail-imap-connection/
@glassfishrobot Commented Reported by dkarp
@glassfishrobot Commented This issue was imported from Bugzilla JAVAMAIL-6827