public final class NodeLogger extends Object
log4j.properties file in the
root of the core package. The configuration can be overridden by specifying a
file in -Dlog4j.configuration (this is the standard log4j
behaviour). Furthermore, it is possible to add and remove additional writers
to this logger. Note, calling setLevel(LEVEL) does only effect
the minimum logging level of the default loggers. All other writers' levels
have to be set before hand.| Modifier and Type | Class and Description |
|---|---|
(package private) class |
NodeLogger.KNIMELogMessage
Class that encapsulates all information of a log message in KNIME such as the
NodeID and
workflow directory if the message can be assigned to them. |
static class |
NodeLogger.LEVEL
The logging levels.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
KNIME_CONSOLE_APPENDER
Name of the default appender to the KNIME console.
|
static String |
LOG_FILE
The default log file name, knime.log.
|
static String |
LOGFILE_APPENDER
Name of the default appender to the log file.
|
static String |
STDERR_APPENDER
Name of the default appender to System.err.
|
static String |
STDOUT_APPENDER
Name of the default appender to System.out.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addKNIMEConsoleWriter(Writer writer,
NodeLogger.LEVEL minLevel,
NodeLogger.LEVEL maxLevel)
Adds a new
Writer with the given level to this logger. |
static void |
addWriter(Writer writer,
Layout layout,
NodeLogger.LEVEL minLevel,
NodeLogger.LEVEL maxLevel)
Adds a new
Writer with the given level to this logger. |
static void |
addWriter(Writer writer,
NodeLogger.LEVEL minLevel,
NodeLogger.LEVEL maxLevel)
Adds a new
Writer with the given level to this logger. |
void |
assertLog(boolean b,
String m)
Check assert and write into logger if failed.
|
void |
assertLog(boolean b,
String m,
AssertionError e)
Check assertions on/off and write debug message into logger.
|
void |
coding(Object o)
Writes CODING PROBLEM plus this message into this logger as error.
|
void |
coding(Object o,
Throwable t)
Writes CODING PROBLEM plus this message, as well as the the message of the throwable into this logger as
error and debug.
|
void |
codingWithFormat(String format,
Object... args)
Write coding message, created by
String.format(String, Object...) into this logger. |
void |
debug(Object o)
Write debugging message into this logger.
|
void |
debug(Object o,
Throwable t)
Write debugging message and throwable into this logger.
|
void |
debugWithFormat(String format,
Object... args)
Write debug message, created by
String.format(String, Object...) into this logger. |
void |
debugWithoutContext(Object o)
Write debugging message into this logger.
|
void |
error(Object o)
Write error message into the logger.
|
void |
error(Object o,
Throwable t)
Write error message and throwable into the logger.
|
void |
errorWithFormat(String format,
Object... args)
Write error message, created by
String.format(String, Object...) into this logger. |
void |
fatal(Object o)
Write fatal error message into the logger.
|
void |
fatal(Object o,
Throwable t)
Write fatal error message and throwable into the logger.
|
void |
fatalWithFormat(String format,
Object... args)
Write fatal message, created by
String.format(String, Object...) into this logger. |
NodeLogger.LEVEL |
getLevel()
Returns the minimum logging retrieved from the underlying Log4J logger.
|
static NodeLogger |
getLogger(Class<?> c)
Creates a new
NodeLogger for the given Class. |
static NodeLogger |
getLogger(String s)
Creates a new
NodeLogger for the given name. |
void |
info(Object o)
Write info message into this logger.
|
void |
info(Object o,
Throwable t)
Write info message and throwable into this logger.
|
void |
infoWithFormat(String format,
Object... args)
Write info message, created by
String.format(String, Object...) into this logger. |
boolean |
isDebugEnabled()
Checks if debug logging level is enabled.
|
boolean |
isEnabledFor(NodeLogger.LEVEL level)
Returns
true if the underlying Log4J logger is enabled for
the given level. |
boolean |
isInfoEnabled()
Checks if info logging level is enabled.
|
static void |
logGlobalMsgsInWfDir(boolean enable)
Allows to enable/disable logging of global messages e.g.
|
static void |
logInWorkflowDir(boolean enable)
Allows to enable/disable logging in the workflow directory.
|
static void |
logNodeId(boolean enable)
Allows to enable/disable node id logging.
|
static void |
removeWriter(Writer writer)
Removes the previously added
Writer from the logger. |
static void |
setAppenderLevelRange(String appenderName,
NodeLogger.LEVEL min,
NodeLogger.LEVEL max)
Sets a level range filter on the given appender.
|
static void |
setLevel(NodeLogger.LEVEL level)
Deprecated.
user
setAppenderLevelRange(String, LEVEL, LEVEL) instead for more fine-grained control |
static void |
setLevelIntern(NodeLogger.LEVEL level)
Deprecated.
|
void |
warn(Object o)
Write warning message into this logger.
|
void |
warn(Object o,
Throwable t)
Write warning message and throwable into this logger.
|
void |
warnWithFormat(String format,
Object... args)
Write warning message, created by
String.format(String, Object...) into this logger. |
public static final String STDOUT_APPENDER
public static final String STDERR_APPENDER
public static final String LOGFILE_APPENDER
public static final String KNIME_CONSOLE_APPENDER
public static final String LOG_FILE
public static NodeLogger getLogger(Class<?> c)
NodeLogger for the given Class.c - The logger's Class.public static NodeLogger getLogger(String s)
NodeLogger for the given name.s - The logger's String.public void warn(Object o)
o - The object to print.public void debug(Object o)
o - The object to print.public void debugWithoutContext(Object o)
o - The object to print.public void info(Object o)
o - The object to print.public void error(Object o)
o - The object to print.public void fatal(Object o)
o - The object to print.public void warn(Object o, Throwable t)
o - The object to print.t - The exception to log at debug level, including its stack trace.public void debug(Object o, Throwable t)
o - The object to print.t - The exception to log, including its stack trace.public void info(Object o, Throwable t)
o - The object to print.t - The exception to log at debug level, including its stack trace.public void error(Object o, Throwable t)
o - The object to print.t - The exception to log at debug level, including its stack trace.public void assertLog(boolean b,
String m)
b - The expression to check.m - Print this message if failed.public void assertLog(boolean b,
String m,
AssertionError e)
b - The expression to check.m - Print this message if failed.e - AssertionError which as been fired.public void coding(Object o)
o - the message to printpublic void coding(Object o, Throwable t)
o - the message to printt - the exception to log at debug level, including its stack tracepublic void fatal(Object o, Throwable t)
o - The object to print.t - The exception to log at debug level, including its stack trace.public void warnWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic void debugWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic void infoWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic void errorWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic void fatalWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic void codingWithFormat(String format, Object... args)
String.format(String, Object...) into this logger. The String is only
formatted if actually necessary.format - the format for printingargs - the arguments for String.format(String, Object...)NullPointerException - if format argument is nullpublic static void addWriter(Writer writer, NodeLogger.LEVEL minLevel, NodeLogger.LEVEL maxLevel)
Writer with the given level to this logger.writer - The writer to add.minLevel - The minimum level to output.maxLevel - The maximum level to output.public static void addKNIMEConsoleWriter(Writer writer, NodeLogger.LEVEL minLevel, NodeLogger.LEVEL maxLevel)
Writer with the given level to this logger.writer - The writer to add.minLevel - The minimum level to output.maxLevel - The maximum level to output.public static void addWriter(Writer writer, Layout layout, NodeLogger.LEVEL minLevel, NodeLogger.LEVEL maxLevel)
Writer with the given level to this logger.writer - The writer to add.layout - the log file layout to useminLevel - The minimum level to output.maxLevel - The maximum level to output.public static void removeWriter(Writer writer)
Writer from the logger.writer - The Writer to remove.@Deprecated public static void setLevelIntern(NodeLogger.LEVEL level)
level - minimum log levelsetLevel(NodeLogger.LEVEL)@Deprecated public static void setLevel(NodeLogger.LEVEL level)
setAppenderLevelRange(String, LEVEL, LEVEL) instead for more fine-grained controlSystem.out and System.err
appender. The maximum logging level stays LEVEL.ALL for
all appenders.level - new minimum logging levelpublic NodeLogger.LEVEL getLevel()
public boolean isDebugEnabled()
true if debug logging level is enabled, otherwise
falsepublic boolean isInfoEnabled()
true if info logging level is enabled, otherwise
falsepublic boolean isEnabledFor(NodeLogger.LEVEL level)
true if the underlying Log4J logger is enabled for
the given level.level - to test logging enabledtrue if logging is enabled, otherwise
falsepublic static void setAppenderLevelRange(String appenderName, NodeLogger.LEVEL min, NodeLogger.LEVEL max) throws NoSuchElementException
appenderName - the name of the appendermin - the minimum logging levelmax - the maximum logging levelNoSuchElementException - if the given appender does not existpublic static void logInWorkflowDir(boolean enable)
enable - true if workflow relative logging should be enabledpublic static void logGlobalMsgsInWfDir(boolean enable)
enable - true if workflow relative logging should be enabledpublic static void logNodeId(boolean enable)
enable - false if workflow relative logging should be globally disabled
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.