Package com.sun.mail.util
Class MailLogger
java.lang.Object
com.sun.mail.util.MailLogger
A simplified logger used by JavaMail to handle logging to a
PrintStream and logging through a java.util.logging.Logger.
If debug is set, messages are written to the PrintStream and
prefixed by the specified prefix (which is not included in
Logger messages).
Messages are logged by the Logger based on the configuration
of the logging system.
-
Constructor Summary
ConstructorsConstructorDescriptionMailLogger
(Class<?> clazz, String prefix, boolean debug, PrintStream out) Construct a new MailLogger using the specified class' package name as the Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.MailLogger
(Class<?> clazz, String subname, String prefix, boolean debug, PrintStream out) Construct a new MailLogger using the specified class' package name combined with the specified subname as the Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.MailLogger
(Class<?> clazz, String prefix, Session session) Deprecated.MailLogger
(String name, String prefix, boolean debug, PrintStream out) Construct a new MailLogger using the specified Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.MailLogger
(String name, String prefix, Session session) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Log a message at the CONFIG level.void
Log a message at the FINE level.void
Log a message at the FINER level.void
Log a message at the FINEST level.Create a MailLogger using the specified class' package name as the Logger name and the specified prefix.Create a MailLogger that uses a Logger with the specified name and prefix.getSubLogger
(String subname, String prefix) Create a MailLogger that uses a Logger whose name is composed of this MailLogger's name plus the specified sub-name, separated by a dot.getSubLogger
(String subname, String prefix, boolean debug) Create a MailLogger that uses a Logger whose name is composed of this MailLogger's name plus the specified sub-name, separated by a dot.boolean
isLoggable
(Level level) If "debug" is set, or our embedded Logger is loggable at the given level, return true.void
Log the message at the specified level.void
Log the message at the specified level.void
Log the message at the specified level.void
Log the message at the specified level.void
Log the message at the specified level using a format string.
-
Constructor Details
-
MailLogger
Construct a new MailLogger using the specified Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.- Parameters:
name
- the Logger nameprefix
- the prefix for debug output, or null for nonedebug
- if true, write to PrintStreamout
- the PrintStream to write to
-
MailLogger
Construct a new MailLogger using the specified class' package name as the Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.- Parameters:
clazz
- the Logger name is the package name of this classprefix
- the prefix for debug output, or null for nonedebug
- if true, write to PrintStreamout
- the PrintStream to write to
-
MailLogger
Construct a new MailLogger using the specified class' package name combined with the specified subname as the Logger name, debug prefix (e.g., "DEBUG"), debug flag, and PrintStream.- Parameters:
clazz
- the Logger name is the package name of this classsubname
- the Logger name relative to this Logger nameprefix
- the prefix for debug output, or null for nonedebug
- if true, write to PrintStreamout
- the PrintStream to write to
-
MailLogger
Deprecated.Construct a new MailLogger using the specified Logger name and debug prefix (e.g., "DEBUG"). Get the debug flag and PrintStream from the Session.- Parameters:
name
- the Logger nameprefix
- the prefix for debug output, or null for nonesession
- where to get the debug flag and PrintStream
-
MailLogger
Deprecated.Construct a new MailLogger using the specified class' package name as the Logger name and the specified debug prefix (e.g., "DEBUG"). Get the debug flag and PrintStream from the Session.- Parameters:
clazz
- the Logger name is the package name of this classprefix
- the prefix for debug output, or null for nonesession
- where to get the debug flag and PrintStream
-
-
Method Details
-
getLogger
Create a MailLogger that uses a Logger with the specified name and prefix. The new MailLogger uses the same debug flag and PrintStream as this MailLogger.- Parameters:
name
- the Logger nameprefix
- the prefix for debug output, or null for none- Returns:
- a MailLogger for the given name and prefix.
-
getLogger
Create a MailLogger using the specified class' package name as the Logger name and the specified prefix. The new MailLogger uses the same debug flag and PrintStream as this MailLogger.- Parameters:
clazz
- the Logger name is the package name of this classprefix
- the prefix for debug output, or null for none- Returns:
- a MailLogger for the given name and prefix.
-
getSubLogger
Create a MailLogger that uses a Logger whose name is composed of this MailLogger's name plus the specified sub-name, separated by a dot. The new MailLogger uses the new prefix for debug output. This is used primarily by the protocol trace code that wants a different prefix (none).- Parameters:
subname
- the Logger name relative to this Logger nameprefix
- the prefix for debug output, or null for none- Returns:
- a MailLogger for the given name and prefix.
-
getSubLogger
Create a MailLogger that uses a Logger whose name is composed of this MailLogger's name plus the specified sub-name, separated by a dot. The new MailLogger uses the new prefix for debug output. This is used primarily by the protocol trace code that wants a different prefix (none).- Parameters:
subname
- the Logger name relative to this Logger nameprefix
- the prefix for debug output, or null for nonedebug
- the debug flag for the sub-logger- Returns:
- a MailLogger for the given name and prefix.
-
log
Log the message at the specified level.- Parameters:
level
- the log level.msg
- the message.
-
log
Log the message at the specified level.- Parameters:
level
- the log level.msg
- the message.param1
- the additional parameter.
-
log
Log the message at the specified level.- Parameters:
level
- the log level.msg
- the message.params
- the message parameters.
-
logf
Log the message at the specified level using a format string.- Parameters:
level
- the log level.msg
- the message format string.params
- the message parameters.- Since:
- JavaMail 1.5.4
-
log
Log the message at the specified level.- Parameters:
level
- the log level.msg
- the message.thrown
- the throwable to log.
-
config
Log a message at the CONFIG level.- Parameters:
msg
- the message.
-
fine
Log a message at the FINE level.- Parameters:
msg
- the message.
-
finer
Log a message at the FINER level.- Parameters:
msg
- the message.
-
finest
Log a message at the FINEST level.- Parameters:
msg
- the message.
-
isLoggable
If "debug" is set, or our embedded Logger is loggable at the given level, return true.- Parameters:
level
- the log level.- Returns:
- true if loggable.
-