|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rapidminer.tools.LogService
public class LogService
Utility class providing static methods for logging.
Parameters read from the XML process configuration file:
LOG_VERBOSITY_NAMESBeside the local log service associated with a concrete process and which will
be automatically initialized during the setup phase, one global log service exist
which is used for generic log messages not bound to the operators used in a process.
This global log service is usually initialized to log messages on system out (at least during the
basic initialization phase of RapidMiner). After the basic intialization phase,
the global messages will be presented in the message viewer (if the RapidMiner GUI
is used) or still printed to system out or in any other stream defined via the
method initGlobalLogging(OutputStream, int). Alternatively, one could also define an
environment variable named RapidMiner.PROPERTY_RAPIDMINER_GLOBAL_LOG_FILE.
Usually, operators should only use the log verbosities MINIMUM for messages with a low priority and STATUS for normal information messages. In rare cases, the verbosity level NOTE could be used for operators stating some message more important then STATUS (hence the user should see the message for the default log verbosity level of INIT) but not as important then WARNING. The verbosity levels WARNING, EXCEPTION, and ERROR should be used in error cases. All other log verbosity levels should only be used by internal RapidMiner classes and not by user written operators.
We recommend to set the parameter for the log verbosity level to INIT for the process design phase (eventually STATUS for debugging) and to the log verbosity level WARNING in the production phase. This way it is ensured that not too many logging messages are produced in the production phase.
Log messages can be formatted by using the following macros:
| Field Summary | |
|---|---|
static int |
ERROR
Use this log verbosity for logging of errors. |
static int |
FATAL
Use this log verbosity for logging of fatal errors which will stop process running somewhere in the future. |
static java.lang.String |
GLOBAL_PREFIX
The prefix used to indicate the global logger. |
static int |
INIT
Only the most important logging messaged should use this log verbosity. |
static int |
IO
Indicates log messages concerning in- and output. |
static java.lang.String[] |
LOG_VERBOSITY_NAMES
|
static int |
MAXIMUM
Normally this log verbosity should not be used by operators. |
static int |
MINIMUM
Indicates the lowest log verbosity. |
static int |
NOTE
Use this log verbosity for logging of important notes, i.e. things less important than warnings but important enough to see for all not interested in the detailed status messages. |
static int |
OFF
For switching off logging during testing. |
static int |
STATUS
The default log verbosity for all logging purposes of operators. |
static int |
UNKNOWN_LEVEL
Indicates an unknown verbosity level. |
static int |
WARNING
Use this log verbosity for logging of warnings. |
| Constructor Summary | |
|---|---|
LogService(Process process)
Creates a log service for this process. |
|
LogService(Process process,
int logVerbosity)
Creates a log service for this process. |
|
| Method Summary | |
|---|---|
void |
flush()
Flush the streams. |
static LogService |
getGlobal()
Returns the global logging. |
java.io.File |
getLogFile()
Returns the current log file or null. |
int |
getVerbosityLevel()
|
static void |
initGlobalLogging(java.io.OutputStream out,
int logVerbosity)
Initializes the global logging, i.e. the global log service not bound to a concrete process. |
void |
initGUI()
|
boolean |
isSufficientLogVerbosity(int level)
|
void |
log(java.lang.String message)
Logs a status message with the correct log service. |
void |
log(java.lang.String message,
int verbosityLevel)
Writes the message to the output stream if the verbosity level is high enough. |
void |
logError(java.lang.String message)
Logs an error message with the correct log service. |
void |
logFinalException(java.lang.String message,
Process process,
java.lang.Throwable exception,
boolean debugMode)
Writes the message and the stack trace of the exception. |
static void |
logMessage(java.lang.String message,
int verbosityLevel)
Deprecated. please do not use this log method any longer, use the method log(String, int) instead |
void |
logNote(java.lang.String message)
Logs a note message with the correct log service. |
void |
logWarning(java.lang.String message)
Logs a warning message with the correct log service. |
void |
setVerbosityLevel(int level)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String GLOBAL_PREFIX
public static final int UNKNOWN_LEVEL
public static final int MINIMUM
public static final int IO
public static final int STATUS
public static final int INIT
public static final int NOTE
public static final int WARNING
public static final int ERROR
public static final int FATAL
public static final int MAXIMUM
public static final int OFF
public static final java.lang.String[] LOG_VERBOSITY_NAMES
| Constructor Detail |
|---|
public LogService(Process process)
throws UndefinedParameterError
UndefinedParameterError
public LogService(Process process,
int logVerbosity)
throws UndefinedParameterError
UndefinedParameterError| Method Detail |
|---|
public static LogService getGlobal()
RapidMiner.PROPERTY_RAPIDMINER_GLOBAL_LOG_FILE.
Alternatively, developers can invoke the method initGlobalLogging(OutputStream, int).
public static void initGlobalLogging(java.io.OutputStream out,
int logVerbosity)
public void initGUI()
throws UndefinedParameterError
UndefinedParameterErrorpublic void flush()
public void setVerbosityLevel(int level)
public int getVerbosityLevel()
public boolean isSufficientLogVerbosity(int level)
@Deprecated
public static void logMessage(java.lang.String message,
int verbosityLevel)
log(String, int) instead
public void log(java.lang.String message,
int verbosityLevel)
public void logFinalException(java.lang.String message,
Process process,
java.lang.Throwable exception,
boolean debugMode)
public java.io.File getLogFile()
public void log(java.lang.String message)
LoggingHandler
log in interface LoggingHandlerpublic void logError(java.lang.String message)
LoggingHandler
logError in interface LoggingHandlerpublic void logNote(java.lang.String message)
LoggingHandler
logNote in interface LoggingHandlerpublic void logWarning(java.lang.String message)
LoggingHandler
logWarning in interface LoggingHandler
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||