Class FallbackLogger
java.lang.Object
de.iip_ecosphere.platform.support.logging.FallbackLogger
- All Implemented Interfaces:
Logger
A fallback logger to sysout/syserr.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.support.logging.Logger
Logger.Emitter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final SimpleDateFormatprivate Logger.Emitterprivate PrintStreamprivate LogLevelprivate Stringprivate PrintStreamprivate static final StringFields inherited from interface de.iip_ecosphere.platform.support.logging.Logger
ROOT_LOGGER_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringabbreviate(String name) Abbreviates a qualified class name.voidLog a message at the DEBUG level.voidLog a message at the DEBUG level according to the specified format and argument.voidLog a message at the DEBUG level according to the specified format and arguments.voidLog a message at the DEBUG level according to the specified format and arguments.voidLog an exception (throwable) at the DEBUG level with an accompanying message.private voidemit(LogLevel level, String msg, Throwable th, PrintStream out) Emits the given messagemsgwith no argument, possibly with the given throwableth.voidLog a message at the ERROR level.voidLog a message at the ERROR level according to the specified format and argument.voidLog a message at the ERROR level according to the specified format and arguments.voidLog a message at the ERROR level according to the specified format and arguments.voidLog an exception (throwable) at the ERROR level with an accompanying message.getLevel()Returns the log level.getName()Returns the name of the logger.voidLog a message at the INFO level.voidLog a message at the INFO level according to the specified format and argument.voidLog a message at the INFO level according to the specified format and arguments.voidLog a message at the INFO level according to the specified format and arguments.voidLog an exception (throwable) at the INFO level with an accompanying message.private booleanReturns whether the given level is enabled.private voidlog(LogLevel level, String msg, Throwable th, PrintStream out) Logs the given messagemsgwith no argument, possibly with the given throwablethiflevelis enabled.private voidlogArgs(LogLevel level, String format, PrintStream out, Object arg) Logs with one argument iflevelis enabled.private voidlogArgs(LogLevel level, String format, PrintStream out, Object[] args) Logs with arbitrary arguments iflevelis enabled.private voidLogs with two arguments iflevelis enabled.private static StringreplaceOnce(String text, String searchString, String replacement) ReplacessearchStringonce intextbyreplacement.booleansetEmitter(Logger.Emitter emitter) Sets the emitter so that the output format can be changed programmatically.booleanSets the log level.voidsetStreams(PrintStream out, PrintStream err) Sets the streams for logging.private StringTurns an argument object to a string value.voidLog a message at the TRACE level.voidLog a message at the TRACE level according to the specified format and argument.voidLog a message at the TRACE level according to the specified format and arguments.voidLog a message at the TRACE level according to the specified format and arguments.voidLog an exception (throwable) at the TRACE level with an accompanying message.voidLog a message at the WARN level.voidLog a message at the WARN level according to the specified format and argument.voidLog a message at the WARN level according to the specified format and arguments.voidLog a message at the WARN level according to the specified format and arguments.voidLog an exception (throwable) at the WARN level with an accompanying message.
-
Field Details
-
DATEFORMAT
-
PLACEHOLDER
- See Also:
-
stringConverter
-
name
-
level
-
out
-
err
-
emitter
-
-
Constructor Details
-
FallbackLogger
Creates an instance.- Parameters:
name- the name of the logger
-
-
Method Details
-
getName
Description copied from interface:LoggerReturns the name of the logger. -
setEmitter
Description copied from interface:LoggerSets the emitter so that the output format can be changed programmatically. May not be supported by all loggers.- Specified by:
setEmitterin interfaceLogger- Parameters:
emitter- the emitter, shall be ignored if null- Returns:
trueif accepted,falseif ignored
-
setStreams
Sets the streams for logging.- Parameters:
out- the output stream (ignored if null)err- the error stream (ignored if null)
-
setLevel
Description copied from interface:LoggerSets the log level. -
getLevel
Returns the log level. -
trace
Description copied from interface:LoggerLog a message at the TRACE level. -
trace
Description copied from interface:LoggerLog a message at the TRACE level according to the specified format and argument. -
trace
Description copied from interface:LoggerLog a message at the TRACE level according to the specified format and arguments. -
trace
Description copied from interface:LoggerLog a message at the TRACE level according to the specified format and arguments. -
trace
Description copied from interface:LoggerLog an exception (throwable) at the TRACE level with an accompanying message. -
debug
Description copied from interface:LoggerLog a message at the DEBUG level. -
debug
Description copied from interface:LoggerLog a message at the DEBUG level according to the specified format and argument. -
debug
Description copied from interface:LoggerLog a message at the DEBUG level according to the specified format and arguments. -
debug
Description copied from interface:LoggerLog a message at the DEBUG level according to the specified format and arguments. -
debug
Description copied from interface:LoggerLog an exception (throwable) at the DEBUG level with an accompanying message. -
info
Description copied from interface:LoggerLog a message at the INFO level. -
info
Description copied from interface:LoggerLog a message at the INFO level according to the specified format and argument. -
info
Description copied from interface:LoggerLog a message at the INFO level according to the specified format and arguments. -
info
Description copied from interface:LoggerLog a message at the INFO level according to the specified format and arguments. -
info
Description copied from interface:LoggerLog an exception (throwable) at the INFO level with an accompanying message. -
warn
Description copied from interface:LoggerLog a message at the WARN level. -
warn
Description copied from interface:LoggerLog a message at the WARN level according to the specified format and argument. -
warn
Description copied from interface:LoggerLog a message at the WARN level according to the specified format and arguments. -
warn
Description copied from interface:LoggerLog a message at the WARN level according to the specified format and arguments. -
warn
Description copied from interface:LoggerLog an exception (throwable) at the WARN level with an accompanying message. -
error
Description copied from interface:LoggerLog a message at the ERROR level. -
error
Description copied from interface:LoggerLog a message at the ERROR level according to the specified format and argument. -
error
Description copied from interface:LoggerLog a message at the ERROR level according to the specified format and arguments. -
error
Description copied from interface:LoggerLog a message at the ERROR level according to the specified format and arguments. -
error
Description copied from interface:LoggerLog an exception (throwable) at the ERROR level with an accompanying message. -
isEnabled
Returns whether the given level is enabled.- Parameters:
level- the target logging level- Returns:
truefor enabled,falseelse
-
emit
Emits the given messagemsgwith no argument, possibly with the given throwableth.- Parameters:
level- the target loglevelmsg- the message, logged is it is, prefixed with logger name, logger level and timeth- optional throwable to be logged, may be nullout- the target output stream
-
log
Logs the given messagemsgwith no argument, possibly with the given throwablethiflevelis enabled.- Parameters:
level- the target loglevelmsg- the message, logged is it is, prefixed with logger name, logger level and timeth- optional throwable to be logged, may be nullout- the target output stream
-
abbreviate
Abbreviates a qualified class name.- Parameters:
name- the name- Returns:
- the abbreviated name
-
toString
Turns an argument object to a string value.- Parameters:
arg- the argument, may be null- Returns:
- the string value
-
logArgs
Logs with one argument iflevelis enabled.- Parameters:
level- the target loglevelformat- the logging format, placeholders as "{}"out- the target output streamarg- the argument
-
logArgs
Logs with two arguments iflevelis enabled.- Parameters:
level- the target loglevelformat- the logging format, placeholders as "{}"out- the target output streamarg1- the first argumentarg2- the second argument
-
logArgs
Logs with arbitrary arguments iflevelis enabled.- Parameters:
level- the target loglevelformat- the logging format, placeholders as "{}"out- the target output streamargs- the arguments
-
replaceOnce
ReplacessearchStringonce intextbyreplacement.- Parameters:
text- the text to search for and to replace withinsearchString- the string to search forreplacement- the replacement string- Returns:
textwith the first occurrence ofsearchStringreplaced
-