This class must be initialized prior to its use: Log::init
For any logged message the log file will contain:
A message always has a level. Logging levels are ordered. Enabling logging at a given level also enables logging at higher levels. The higher the level the more important and urgent the message.
The levels, in descending order of severity, are:
error (highest severity) is a message level indicating a serious failure. In general error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.
warning is a message level indicating a potential problem. In general warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.
info is a message level for informational messages. Typically info messages should be reasonably significant and should make sense to end users and system administrators.
config is a message level for static configuration messages. config messages are intended to provide a variety of static configuration information, to assist in debugging problems that may be associated with particular configurations.
fine is a message level providing tracing information. In general the fine level should be used for information that will be broadly interesting to developers. This level is for the lowest volume, and most important, tracing messages.
finer indicates a moderately detailed tracing message. This is an intermediate level between fine and finest.
finest indicates a very detailed tracing message. Logging calls for entering, returning, or throwing an exception are traced at the finest level.
debug (lowest severity) indicates a highly detailed tracing message. In general the debug level should be used for the most voluminous detailed tracing messages. For each level methods exist that will request a message, at that level, to be logged. These methods are all named after their level.
For each level a method exists that indicates if messages at that level will currently be logged. The names of these methods are of the form: levelEnabled.
Static Public Member Functions | |
| static LogLevel | charsToLevel (const char *chars) |
| returns log level specified by "chars", or throws IllegalArgumentException. | |
| static void | close () |
| closes logging facility (until next init). | |
| static void | config (const char *msg) |
| Logs a message. | |
| static void | configCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | configEnabled () |
| Returns whether "config" log messages are enabled. | |
| static void | configThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | debug (const char *msg) |
| Logs a message. | |
| static void | debugCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | debugEnabled () |
| Returns whether "debug" log messages are enabled. | |
| static void | debugThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static bool | enabled (LogLevel level) |
| Returns whether log messages at given level are enabled. | |
| static void | error (const char *msg) |
| Logs a message. | |
| static void | errorCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | errorEnabled () |
| Returns whether "error" log messages are enabled. | |
| static void | errorThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | fine (const char *msg) |
| Logs a message. | |
| static void | fineCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | fineEnabled () |
| Returns whether "fine" log messages are enabled. | |
| static void | finer (const char *msg) |
| Logs a message. | |
| static void | finerCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | finerEnabled () |
| Returns whether "finer" log messages are enabled. | |
| static void | finerThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | finest (const char *msg) |
| Logs a message. | |
| static void | finestCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | finestEnabled () |
| Returns whether "finest" log messages are enabled. | |
| static void | finestThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | fineThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static char * | formatLogLine (char *buf, LogLevel level) |
| Fills the provided buffer with formatted log-line given the level and returns the buffer. | |
| static void | info (const char *msg) |
| Logs a message. | |
| static void | infoCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | infoEnabled () |
| Returns whether "info" log messages are enabled. | |
| static void | infoThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | init (LogLevel level, const char *logFileName, int32 logFileLimit=0, int64 logDiskSpaceLimit=0) |
| Initializes logging facility with given level and filenames. | |
| static const char * | levelToChars (Log::LogLevel level) |
| returns character string for given log level. | |
| static void | log (LogLevel level, const char *msg) |
| Logs a message at given level. | |
| static void | logCatch (LogLevel level, const char *msg, const Exception &ex) |
| Logs both a message and caught exception. | |
| static const char * | logFileName () |
| |
| static LogLevel | logLevel () |
| Returns the current log level. | |
| static void | logThrow (LogLevel level, const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static void | setLogLevel (LogLevel level) |
| Set the current log level. | |
| static void | warning (const char *msg) |
| Logs a message. | |
| static void | warningCatch (const char *msg, const Exception &ex) |
| Writes both a message and caught exception. | |
| static bool | warningEnabled () |
| Returns whether "warning" log messages are enabled. | |
| static void | warningThrow (const char *msg, const Exception &ex) |
| Logs both a message and thrown exception. | |
| static LogLevel gemfire::Log::charsToLevel | ( | const char * | chars | ) | [static] |
returns log level specified by "chars", or throws IllegalArgumentException.
Allowed values are identical to the enum declaration above for LogLevel, but with character case ignored.
| static void gemfire::Log::close | ( | ) | [static] |
closes logging facility (until next init).
| static void gemfire::Log::config | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "config".
| static void gemfire::Log::configCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "config".
| static bool gemfire::Log::configEnabled | ( | ) | [inline, static] |
Returns whether "config" log messages are enabled.
| static void gemfire::Log::configThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "config".
| static void gemfire::Log::debug | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "debug".
| static void gemfire::Log::debugCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "debug".
| static bool gemfire::Log::debugEnabled | ( | ) | [inline, static] |
Returns whether "debug" log messages are enabled.
| static void gemfire::Log::debugThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "debug".
| static bool gemfire::Log::enabled | ( | LogLevel | level | ) | [inline, static] |
Returns whether log messages at given level are enabled.
| static void gemfire::Log::error | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "error".
| static void gemfire::Log::errorCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "error".
| static bool gemfire::Log::errorEnabled | ( | ) | [inline, static] |
Returns whether "error" log messages are enabled.
| static void gemfire::Log::errorThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "error".
| static void gemfire::Log::fine | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "fine".
| static void gemfire::Log::fineCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "fine".
| static bool gemfire::Log::fineEnabled | ( | ) | [inline, static] |
Returns whether "fine" log messages are enabled.
| static void gemfire::Log::finer | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "finer".
| static void gemfire::Log::finerCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "finer".
| static bool gemfire::Log::finerEnabled | ( | ) | [inline, static] |
Returns whether "finer" log messages are enabled.
| static void gemfire::Log::finerThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "finer".
| static void gemfire::Log::finest | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "finest".
| static void gemfire::Log::finestCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "finest".
| static bool gemfire::Log::finestEnabled | ( | ) | [inline, static] |
Returns whether "finest" log messages are enabled.
| static void gemfire::Log::finestThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "finest".
| static void gemfire::Log::fineThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "fine".
| static char* gemfire::Log::formatLogLine | ( | char * | buf, | |
| LogLevel | level | |||
| ) | [static] |
Fills the provided buffer with formatted log-line given the level and returns the buffer.
This assumes that the buffer has large enough space left to hold the formatted log-line (around 70 chars).
This is provided so that applications wishing to use the same format as GemFire log-lines can do so easily. A log-line starts with the prefix given below which is filled in by this method: [<level> <date> <time> <timezone> <host>:<process id>=""> <thread id>="">]
This method is not thread-safe for the first invocation. When invoking from outside either <init> should have been invoked, or at least the first invocation should be single-threaded.
| static void gemfire::Log::info | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "info".
| static void gemfire::Log::infoCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "info".
| static bool gemfire::Log::infoEnabled | ( | ) | [inline, static] |
Returns whether "info" log messages are enabled.
| static void gemfire::Log::infoThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "info".
| static void gemfire::Log::init | ( | LogLevel | level, | |
| const char * | logFileName, | |||
| int32 | logFileLimit = 0, |
|||
| int64 | logDiskSpaceLimit = 0 | |||
| ) | [static] |
Initializes logging facility with given level and filenames.
This method is called automatically within DistributedSystem::connect with the log-file, log-level, and log-file-size system properties used as arguments
| static const char* gemfire::Log::levelToChars | ( | Log::LogLevel | level | ) | [static] |
returns character string for given log level.
The string will be identical to the enum declaration above, except it will be all lower case. Out of range values will throw IllegalArgumentException.
| static void gemfire::Log::log | ( | LogLevel | level, | |
| const char * | msg | |||
| ) | [inline, static] |
Logs a message at given level.
| static void gemfire::Log::logCatch | ( | LogLevel | level, | |
| const char * | msg, | |||
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and caught exception.
| static const char* gemfire::Log::logFileName | ( | ) | [static] |
NOTE: This function is for debugging only, as it is not completely thread-safe!
| static LogLevel gemfire::Log::logLevel | ( | ) | [inline, static] |
Returns the current log level.
| static void gemfire::Log::logThrow | ( | LogLevel | level, | |
| const char * | msg, | |||
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
| static void gemfire::Log::setLogLevel | ( | LogLevel | level | ) | [inline, static] |
Set the current log level.
| static void gemfire::Log::warning | ( | const char * | msg | ) | [inline, static] |
Logs a message.
The message level is "warning".
| static void gemfire::Log::warningCatch | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Writes both a message and caught exception.
The message level is "warning".
| static bool gemfire::Log::warningEnabled | ( | ) | [inline, static] |
Returns whether "warning" log messages are enabled.
| static void gemfire::Log::warningThrow | ( | const char * | msg, | |
| const Exception & | ex | |||
| ) | [inline, static] |
Logs both a message and thrown exception.
The message level is "warning".