|
class | blaze::logging::FunctionTrace |
| RAII object for function tracing.The FunctionTrace class is an auxiliary helper class for the tracing of function calls. It is implemented as a wrapper around the Logger class and is responsible for the atomicity of the logging operations of trace information. More...
|
|
class | blaze::logging::Logger |
| Implementation of a logger class.The Logger class represents the core of the logging functionality. It is responsible for commiting logging messages immediately to the according log file(s). The logger works for both serial as well as MPI parallel environments. In case of a non-MPI-parallel simulation the Logger creates the log file 'blaze.log', which contains all logging information from all logging levels. In case of a MPI parallel simulation, each process creates his own individual log file called 'blazeX.log', where 'X' is replaced by the according rank the process has in the MPI_COMM_WORLD communicator.
Note that the log file(s) are only created in case any logging information is created. This might for instance result in only a small number of log file(s) in MPI parallel simulations when only some of the processes encounter errors/warnings/etc.
Note that the logging functionality may not be used before MPI_Init() has been finished. In consequence, this means that no global data that is initialized before the main() function may contain any use of the logging functionality! More...
|
|
class | blaze::logging::LogSection |
| Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class for all logging section macros. It is implemented as a wrapper around the Logger class and is responsible for the atomicity of the logging operations and for formatting any message that is written into the log file(s). More...
|
|
|
#define | BLAZE_LOG_DEBUG_SECTION(NAME) |
| Logging section for debug information.This macro starts a log section for debug information. These messages are written to the log file(s) in case the blaze::loglevel has been set to debug or higher. The following example demonstrates how this log section is used: More...
|
|
#define | BLAZE_LOG_DETAIL_SECTION(NAME) |
| Logging section for debug information.This macro starts a log section for detail information. These messages are written to the log file(s) in case the blaze::loglevel has been set to detail or higher. The following example demonstrates how this log section is used: More...
|
|
#define | BLAZE_LOG_ERROR_SECTION(NAME) |
| Logging section for (severe) error messages.This macro starts a log section for (severe) error messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to error or higher. The following example demonstrates how this log section is used: More...
|
|
#define | BLAZE_FUNCTION_TRACE |
| Function trace macro.This macro can be used to reliably trace function calls. In case function tracing is activated, the traces are logged via the Logger class. The following, short example demonstrates how the function trace macro is used: More...
|
|
#define | BLAZE_LOG_INFO_SECTION(NAME) |
| Logging section for information messages.This macro starts a log section for information messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to info or higher. The following example demonstrates how this log section is used: More...
|
|
#define | BLAZE_LOG_PROGRESS_SECTION(NAME) |
| Logging section for progress information.This macro starts a log section for information messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to progress or higher. The following example demonstrates how this log section is used: More...
|
|
#define | BLAZE_LOG_WARNING_SECTION(NAME) |
| Logging section for warning messages.This macro starts a log section for warning messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to warning or higher. The following example demonstrates how this log section is used: More...
|
|
The logging submodule offers the functionality for the creation of log information in both non-parallel and MPI-/thread-parallel environments. The logging functionality is implemented such that in case no logging is required no runtime and memory overhead occur. However, in case it is necessary to log information, this is done as efficiently and reliably as possible. In non-parallel environments, a single log file named 'blaze.log' is created, containing all the information of the single process. In MPI-parallel environments, each process creates his own log file named 'blazeX.log', where 'X' is replaced by his according process rank in the MPI_COMM_WORLD communicator. Depending on the selected logging level information about (severe) errors, warnings, important information, progress reports, debug information, and detailed output is written to the log file(s). The global log level is specified via the blaze::loglevel variable in the configuration file "blaze/config/Logging.h". The following logging level's are available:
- inactive: Completely deactivates the logging functionality, i.e., no log file(s) will be written. Since this setting can immensely complicate error correction, it is not recommended to use this setting!
- error : Only (severe) errors are written to the log file(s).
- warning : Extends the error setting by warning messages.
- info : Extends the warning setting by additional informative messages (default).
- progress: Extends the info setting by progress information.
- debug : Extends the progress setting by debug information.
- detail : Extends the debug setting by very fine grained detail information.
Logging is done via one of the six following log sections:
- blaze::BLAZE_LOG_ERROR_SECTION : Section for (severe) error messages; blaze::loglevel >= error
- blaze::BLAZE_LOG_WARNING_SECTION : Section for warning messages; blaze::loglevel >= warning
- blaze::BLAZE_LOG_INFO_SECTION : Section for important information; blaze::loglevel >= info
- blaze::BLAZE_LOG_PROGRESS_SECTION: Section for progress information; blaze::loglevel >= progress
- blaze::BLAZE_LOG_DEBUG_SECTION : Section for debug information; blaze::loglevel >= debug
- blaze::BLAZE_LOG_DETAIL_SECTION : Section for detail information; blaze::loglevel >= detail
The following example demonstrates the use of the log sections:
int main( int argc, char** argv )
{
MPI_Init( &argc, &argv );
log << " Only printed within an active BLAZE_LOG_ERROR_SECTION\n"
<< " for demonstration purposes!\n";
}
log << " Only printed within an active BLAZE_LOG_WARNING_SECTION!\n";
}
MPI_Finalize();
}
Executing this main() function results in the following log file (provided the logging level is set accordingly):
--LOG BEGIN, Thursday, 14.January 2010, 08:31--------------------------------------------
for demonstration purposes!
--LOG END, Thursday, 14.January 2010, 08:31----------------------------------------------
The next example shows to nested log sections. Please note that this combination only makes sense in case the outer log section has a lower log level:
{
error <<
" Only printed within an active BLAZE_LOG_ERROR_SECTION\n";
warning <<
" Only printed within an active BLAZE_LOG_WARNING_SECTION\n";
}
error <<
" Again only printed within an active BLAZE_LOG_ERROR_SECTION\n";
}
Although the BLAZE_LOG_ERROR_SECTION is the outer section, the BLAZE_LOG_WARNING_SECTION appears first in the log file:
--LOG BEGIN, Thursday, 14.January 2010, 08:31--------------------------------------------
--LOG END, Thursday, 14.January 2010, 08:31----------------------------------------------
In order to commit the messages in the correct order, it is necessary to manually call the commit function:
{
error <<
" Only printed within an active BLAZE_LOG_ERROR_SECTION\n";
warning <<
" Only printed within an active BLAZE_LOG_WARNING_SECTION\n";
}
error <<
" Again only printed within an active BLAZE_LOG_ERROR_SECTION\n";
}
This results in the following log file:
--LOG BEGIN, Thursday, 14.January 2010, 08:31--------------------------------------------
--LOG END, Thursday, 14.January 2010, 08:31----------------------------------------------
#define BLAZE_FUNCTION_TRACE |
Function trace macro.This macro can be used to reliably trace function calls. In case function tracing is activated, the traces are logged via the Logger class. The following, short example demonstrates how the function trace macro is used:
1 int main( int argc, char** argv )
The macro should be used as the very first statement inside the function in order to guarantee that logging the function trace is the very first and last action of the function call.
Function tracing can be enabled or disabled via the BLAZE_USE_FUNCTION_TRACES macro. If function tracing is activated, the resulting log will contain trace information of the following form:
1 [TRACE ][000:00:00] + Entering function 'int main()' in file 'TraceDemo.cpp'
2 [TRACE ][000:00:10] - Leaving function 'int main()' in file 'TraceDemo.cpp'
In case function tracing is deactivated, all function trace functionality is completely removed from the code, i.e. no function traces are logged and no overhead results from the BLAZE_FUNCTION_TRACE macro.
#define BLAZE_LOG_DEBUG_SECTION |
( |
|
NAME | ) |
|
Value:
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
Log level for debug information.
Definition: LogLevel.h:82
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for debug information.This macro starts a log section for debug information. These messages are written to the log file(s) in case the blaze::loglevel has been set to debug or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for debug information
13 // This section is only executed in case the logging level is at least 'debug'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_DEBUG_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_DEBUG_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_DEBUG_SECTION might result in lost and/or unlogged information!
#define BLAZE_LOG_DETAIL_SECTION |
( |
|
NAME | ) |
|
Value:
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
Log level for detail information.
Definition: LogLevel.h:83
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for debug information.This macro starts a log section for detail information. These messages are written to the log file(s) in case the blaze::loglevel has been set to detail or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for detail information
13 // This section is only executed in case the logging level is at least 'detail'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_DETAIL_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_DETAIL_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_DETAIL_SECTION might result in lost and/or unlogged information!
#define BLAZE_LOG_ERROR_SECTION |
( |
|
NAME | ) |
|
Value:
Log level for (sever) errors.
Definition: LogLevel.h:78
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for (severe) error messages.This macro starts a log section for (severe) error messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to error or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for error messages
13 // This section is only executed in case the logging level is at least 'error'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_ERROR_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_ERROR_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_ERROR_SECTION might result in lost and/or unlogged information!
#define BLAZE_LOG_INFO_SECTION |
( |
|
NAME | ) |
|
Value:
Log level for high-level information.
Definition: LogLevel.h:80
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for information messages.This macro starts a log section for information messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to info or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for information messages
13 // This section is only executed in case the logging level is at least 'info'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_INFO_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_INFO_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_INFO_SECTION might result in lost and/or unlogged information!
#define BLAZE_LOG_PROGRESS_SECTION |
( |
|
NAME | ) |
|
Value:
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
Log level for progress information.
Definition: LogLevel.h:81
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for progress information.This macro starts a log section for information messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to progress or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for progress information
13 // This section is only executed in case the logging level is at least 'progress'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_PROGRESS_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_PROGRESS_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_PROGRESS_SECTION might result in lost and/or unlogged information!
#define BLAZE_LOG_WARNING_SECTION |
( |
|
NAME | ) |
|
Value:
Logging section for (non-)MPI-parallel environments.The LogSection class is an auxiliary helper class...
Definition: LogSection.h:67
Log level for warnings.
Definition: LogLevel.h:79
const LogLevel loglevel
Setting of the logging level.This value specifies the logging level of the Blaze logging functionalit...
Definition: Logging.h:58
Logging section for warning messages.This macro starts a log section for warning messages. These messages are written to the log file(s) in case the blaze::loglevel has been set to warning or higher. The following example demonstrates how this log section is used:
1 int main( int argc, char** argv )
3 // Initialization of the MPI system (for MPI parallel simulations)
4 // The MPI system must be initialized before any logging functionality may be used. In
5 // case it was not called before the first log section it is assumed that the simulation
6 // does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
7 // to make MPI_Init() the very first call of the main function.
8 MPI_Init( &argc, &argv );
12 // Log section for warning messages
13 // This section is only executed in case the logging level is at least 'warning'. The
14 // macro parameter specifies the name of the log handle (in this example 'log') that
15 // can be used as a stream to log any kind of streamable information.
16 BLAZE_LOG_WARNING_SECTION( log ) {
17 log << " Only printed within an active BLAZE_LOG_WARNING_SECTION!\n";
22 // Finalizing the MPI system (for MPI parallel simulations)
23 // The MPI system must be finalized after the last pe functionality has been used. It
24 // is recommended to make MPI_Finalize() the very last call of the main function.
Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_WARNING_SECTION might result in lost and/or unlogged information!
Logging levels.The LogLevel type enumeration represents the type of the global logging level. It defines all possible levels for the logging functionality. Depending on the setting of the global logging level (see blaze::logLevel), more or less information will be written to the log file(s). The following logging levels are available:
- inactive: Completely deactivates the logging functionality, i.e., no log file(s) will be written. Since this setting can immensely complicate error correction, it is not recommended to use this setting!
- error : Only (severe) errors are written to the log file(s).
- warning : Extends the error setting by warning messages (default).
- info : Extends the warning setting by additional informative messages.
- progress: Extends the info setting by progress information.
- debug : Extends the progress setting by debug information.
- detail : Extends the debug setting by very fine grained detail information.
inactive plays a special role in the way that it switches off the logging functionality completely, i.e., no log file(s) will be created. The highest logging level is error, which exclusively writes severe errors to the log file(s). The lowest logging level is detail, which can create a tremendous amount of logging information. Note that each logging level comprises all higher logging levels. For instance, progress will also print all errors and warning to the log file(s).
Enumerator |
---|
inactive |
Log level for no logging.
|
error |
Log level for (sever) errors.
|
warning |
Log level for warnings.
|
info |
Log level for high-level information.
|
progress |
Log level for progress information.
|
debug |
Log level for debug information.
|
detail |
Log level for detail information.
|
template<typename Type >
LogSection & blaze::logging::operator<< |
( |
LogSection & |
logsection, |
|
|
const Type & |
message |
|
) |
| |
|
inline |
Global output operator for the LogSection class.
- Parameters
-
logsection | Reference to the log section. |
message | Reference to the log message. |
- Returns
- Reference to the log section.