|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.shell.support.logging.HandlerUtils
public abstract class HandlerUtils
Utility methods for dealing with Handler
objects.
Constructor Summary | |
---|---|
HandlerUtils()
|
Method Summary | |
---|---|
static int |
flushAllHandlers(Logger logger)
Forces all Handler instances registered in the presented Logger to be flushed. |
static Logger |
getLogger(Class<?> clazz)
Obtains a Logger that guarantees to set the Level
to Level.FINE if it is part of org.springframework.roo. |
static int |
registerTargetHandler(Logger logger,
Handler target)
Registers the presented target Handler against any DeferredLogHandler encountered in the presented
Logger . |
static int |
wrapWithDeferredLogHandler(Logger logger,
Level fallbackSeverity)
Replaces each Handler defined against the presented Logger with DeferredLogHandler . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HandlerUtils()
Method Detail |
---|
public static Logger getLogger(Class<?> clazz)
Logger
that guarantees to set the Level
to Level.FINE
if it is part of org.springframework.roo.
Unfortunately this is needed due to a regression in JDK 1.6.0_18
as per issue ROO-539.
clazz
- to retrieve the logger for (required)
Level.FINE
if no level was specifiedpublic static int wrapWithDeferredLogHandler(Logger logger, Level fallbackSeverity)
Handler
defined against the presented Logger
with DeferredLogHandler
.
This is useful for ensuring any Handler
defaults defined by the user are preserved and treated as the
DeferredLogHandler
"fallback" Handler
if the indicated severity Level
is encountered.
This method will create a ConsoleHandler
if the presented Logger
has no current Handler
.
logger
- to introspect and replace the Handler
s for (required)fallbackSeverity
- to trigger fallback mode (required)
DeferredLogHandler
s now registered against the Logger
(guaranteed to be 1 or above)public static int registerTargetHandler(Logger logger, Handler target)
Handler
against any DeferredLogHandler
encountered in the presented
Logger
.
Generally this method is used on Logger
instances that have previously been presented to the
wrapWithDeferredLogHandler(Logger, Level)
method.
The method will return a count of how many DeferredLogHandler
instances it detected. Note that no
attempt is made to distinguish between instances already possessing the intended target Handler
or those already possessing any target Handler
at all. This method always overwrites the target
Handler
and the returned count represents how many overwrites took place.
logger
- to introspect for DeferredLogHandler
instances (required)target
- to set as the target Handler
DeferredLogHandler
instances detected and updated (may be 0 if none found)public static int flushAllHandlers(Logger logger)
Handler
instances registered in the presented Logger
to be flushed.
logger
- to flush (required)
Handler
s flushed (may be 0 or above)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |