Interface Logger
-
- All Implemented Interfaces:
public interface Logger
-
-
Method Summary
Modifier and Type Method Description abstract LoggercreateChildLogger(String name, Map<String, String> context)Create a 'child' logger which derives from this one. abstract LoggercreateChildLogger(String name)Create a 'child' logger which derives from this one. abstract voidsetUseParentHandlers(boolean useParentHandlers)See setUseParentHandlers abstract voidaddHandler(Handler handler)See addHandler abstract voidremoveHandler(Handler handler)See removeHandler abstract booleanisTraceEnabled()Check if a message with a TRACE level would actually be logged by this logger. abstract voidtrace(Object msg)Log a TRACE message. abstract voidtrace(Supplier<String> msgSupplier)Log a TRACE message. abstract booleanisDebugEnabled()Check if a message with a DEBUG level would actually be logged by this logger. abstract voiddebug(Object msg)Log a DEBUG message. abstract voiddebug(Supplier<String> msgSupplier)Log a DEBUG message. abstract booleanisInfoEnabled()Check if a message with an INFO level would actually be logged by this logger. abstract voidinfo(Object msg)Log an INFO message. abstract voidinfo(Supplier<String> msgSupplier)Log an INFO message. abstract booleanisWarnEnabled()Check if a message with a WARN level would actually be logged by this logger. abstract voidwarn(Object msg)Log a WARN message. abstract voidwarn(Supplier<String> msgSupplier)Log a WARN message. abstract voidwarn(Object msg, Throwable t)Log a message, with associated Throwable information. abstract voiderror(Object msg)Log a ERROR message. abstract voiderror(Supplier<String> msgSupplier)Log an ERROR message. abstract voiderror(Object msg, Throwable t)Log a message, with associated Throwable information. abstract voidsetLevelError()Set logging level for all handlers to ERROR abstract voidsetLevelWarn()Set logging level for all handlers to WARNING abstract voidsetLevelInfo()Set logging level for all handlers to INFO abstract voidsetLevelDebug()Set logging level for all handlers to DEBUG abstract voidsetLevelTrace()Set logging level for all handlers to TRACE abstract voidsetLevelAll()Set logging level for all handlers to ALL (allow all log messages) abstract voidsetLevelOff()Set logging level for all handlers to OFF (allow no log messages) abstract voidsetLevel(Level level)Set logging level for all handlers to level abstract LevelgetLevel()abstract voidaddContext(Map<String, String> addedContext)Add additional log context to this logger abstract voidaddContext(String key, String value)Add additional log context to this logger abstract voidremoveContext(String key)Remove a context key/value pair from this logger. -
-
Method Detail
-
createChildLogger
abstract Logger createChildLogger(String name, Map<String, String> context)
Create a 'child' logger which derives from this one. The child logger will share the same log level setting as this one and its LogContext (given here) will, in addition to the values it contains, have the parent logger's context merged into it (the child's context values take priority in case of a conflict)
- Returns:
the created logger
-
createChildLogger
abstract Logger createChildLogger(String name)
Create a 'child' logger which derives from this one. The child logger will share the same log level setting as this one and it will inherit this logger's LogContext
- Returns:
the created logger
-
setUseParentHandlers
abstract void setUseParentHandlers(boolean useParentHandlers)
-
addHandler
abstract void addHandler(Handler handler)
See addHandler
-
removeHandler
abstract void removeHandler(Handler handler)
See removeHandler
-
isTraceEnabled
abstract boolean isTraceEnabled()
Check if a message with a TRACE level would actually be logged by this logger.
- Returns:
true if the TRACE level is currently being logged
-
trace
abstract void trace(Object msg)
Log a TRACE message.
If the logger is currently enabled for the TRACE message level then the given message is forwarded to all the registered output Handler objects.
- Parameters:
msg- The message to log
-
trace
abstract void trace(Supplier<String> msgSupplier)
Log a TRACE message. Only invokes the given supplier if the TRACE level is currently loggable.
- Parameters:
msgSupplier- a Supplier which will return the log mesage when invoked
-
isDebugEnabled
abstract boolean isDebugEnabled()
Check if a message with a DEBUG level would actually be logged by this logger.
- Returns:
true if the DEBUG level is currently being logged
-
debug
abstract void debug(Object msg)
Log a DEBUG message.
If the logger is currently enabled for the DEBUG message level then the given message is forwarded to all the registered output Handler objects.
- Parameters:
msg- The message to log
-
debug
abstract void debug(Supplier<String> msgSupplier)
Log a DEBUG message. Only invokes the given supplier if the DEBUG level is currently loggable.
- Parameters:
msgSupplier- a Supplier which will return the log mesage when invoked
-
isInfoEnabled
abstract boolean isInfoEnabled()
Check if a message with an INFO level would actually be logged by this logger.
- Returns:
true if the INFO level is currently being logged
-
info
abstract void info(Object msg)
Log an INFO message.
If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
- Parameters:
msg- The message to log
-
info
abstract void info(Supplier<String> msgSupplier)
Log an INFO message. Only invokes the given supplier if the INFO level is currently loggable.
- Parameters:
msgSupplier- a Supplier which will return the log mesage when invoked
-
isWarnEnabled
abstract boolean isWarnEnabled()
Check if a message with a WARN level would actually be logged by this logger.
- Returns:
true if the WARN level is currently being logged
-
warn
abstract void warn(Object msg)
Log a WARN message.
If the logger is currently enabled for the WARN message level then the given message is forwarded to all the registered output Handler objects.
- Parameters:
msg- The message to log
-
warn
abstract void warn(Supplier<String> msgSupplier)
Log a WARN message. Only invokes the given supplier if the WARN level is currently loggable.
- Parameters:
msgSupplier- a Supplier which will return the log mesage when invoked
-
warn
abstract void warn(Object msg, Throwable t)
Log a message, with associated Throwable information.
- Parameters:
msg- The message to logt- Throwable associated with log message.
-
error
abstract void error(Object msg)
Log a ERROR message.
If the logger is currently enabled for the ERROR message level then the given message is forwarded to all the registered output Handler objects.
- Parameters:
msg- The message to log
-
error
abstract void error(Supplier<String> msgSupplier)
Log an ERROR message. Only invokes the given supplier if the ERROR level is currently loggable.
- Parameters:
msgSupplier- a Supplier which will return the log mesage when invoked
-
error
abstract void error(Object msg, Throwable t)
Log a message, with associated Throwable information.
- Parameters:
msg- The message to logt- Throwable associated with log message.
-
setLevelError
abstract void setLevelError()
Set logging level for all handlers to ERROR
-
setLevelWarn
abstract void setLevelWarn()
Set logging level for all handlers to WARNING
-
setLevelInfo
abstract void setLevelInfo()
Set logging level for all handlers to INFO
-
setLevelDebug
abstract void setLevelDebug()
Set logging level for all handlers to DEBUG
-
setLevelTrace
abstract void setLevelTrace()
Set logging level for all handlers to TRACE
-
setLevelAll
abstract void setLevelAll()
Set logging level for all handlers to ALL (allow all log messages)
-
setLevelOff
abstract void setLevelOff()
Set logging level for all handlers to OFF (allow no log messages)
-
setLevel
abstract void setLevel(Level level)
Set logging level for all handlers to level
- Parameters:
level- the level to set for all logger handlers
-
getLevel
abstract Level getLevel()
- Returns:
the Level configured for this java.util.logging.Logger.
-
addContext
abstract void addContext(Map<String, String> addedContext)
Add additional log context to this logger
- Parameters:
addedContext- a map of key, value pairs of the key names and values to add
-
addContext
abstract void addContext(String key, String value)
Add additional log context to this logger
- Parameters:
key- the context keyvalue- the context value
-
removeContext
abstract void removeContext(String key)
Remove a context key/value pair from this logger.
- Parameters:
key- the key to remove.
-
-
-
-