All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Enumerations

Classes

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...
 

Macros

#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:
 
#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:
 
#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:
 
#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:
 
#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:
 
#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:
 

Enumerations

enum  blaze::logging::LogLevel {
  blaze::logging::inactive = 0, blaze::logging::error = 1, blaze::logging::warning = 2, blaze::logging::info = 3,
  blaze::logging::progress = 4, blaze::logging::debug = 5, blaze::logging::detail = 6
}
 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: More...
 

LogSection operators

template<typename Type >
LogSection & blaze::logging::operator<< (LogSection &logsection, const Type &message)
 Global output operator for the LogSection class.
 

Detailed Description

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:

Logging is done via one of the six following log sections:

The following example demonstrates the use of the log sections:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations only)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for error messages
// This section is only executed in case the logging level is at least 'error'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_ERROR_SECTION\n"
<< " for demonstration purposes!\n";
}
// Log section for warning messages
// This section is only executed in case the logging level is at least 'warning'. Again,
// the macro parameter specifies the name of the log handle that can be used as a stream
// to any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_WARNING_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations only)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
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--------------------------------------------
[ERROR ] Only printed within an active BLAZE_LOG_ERROR_SECTION
for demonstration purposes!
[WARNING ] Only printed within an active BLAZE_LOG_WARNING_SECTION!
--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--------------------------------------------
[WARNING ] Only printed within an active BLAZE_LOG_WARNING_SECTION
[ERROR ] Only printed within an active BLAZE_LOG_ERROR_SECTION
Again only printed within an active BLAZE_LOG_ERROR_SECTION
--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";
// Manual call of the commit function
error.commit();
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--------------------------------------------
[ERROR ] Only printed within an active BLAZE_LOG_ERROR_SECTION
[WARNING ] Only printed within an active BLAZE_LOG_WARNING_SECTION
[ERROR ] Again only printed within an active BLAZE_LOG_ERROR_SECTION
--LOG END, Thursday, 14.January 2010, 08:31----------------------------------------------

Macro Definition Documentation

#define BLAZE_LOG_DEBUG_SECTION (   NAME)
Value:

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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for debug information
// This section is only executed in case the logging level is at least 'debug'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_DEBUG_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

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 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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for detail information
// This section is only executed in case the logging level is at least 'detail'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_DETAIL_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

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:

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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for error messages
// This section is only executed in case the logging level is at least 'error'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_ERROR_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

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:

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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for information messages
// This section is only executed in case the logging level is at least 'info'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_INFO_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

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 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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for progress information
// This section is only executed in case the logging level is at least 'progress'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_PROGRESS_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

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 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:

int main( int argc, char** argv )
{
// Initialization of the MPI system (for MPI parallel simulations)
// The MPI system must be initialized before any logging functionality may be used. In
// case it was not called before the first log section it is assumed that the simulation
// does not run in parallel. Thus in MPI-parallel simulations it is strongly recommended
// to make MPI_Init() the very first call of the main function.
MPI_Init( &argc, &argv );
// ...
// Log section for warning messages
// This section is only executed in case the logging level is at least 'warning'. The
// macro parameter specifies the name of the log handle (in this example 'log') that
// can be used as a stream to log any kind of streamable information.
log << " Only printed within an active BLAZE_LOG_WARNING_SECTION!\n";
}
// ...
// Finalizing the MPI system (for MPI parallel simulations)
// The MPI system must be finalized after the last pe functionality has been used. It
// is recommended to make MPI_Finalize() the very last call of the main function.
MPI_Finalize();
}

Note that uncaught exceptions emitted from the blaze::BLAZE_LOG_WARNING_SECTION might result in lost and/or unlogged information!

Enumeration Type Documentation

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.

Function Documentation

template<typename Type >
LogSection & blaze::logging::operator<< ( LogSection &  logsection,
const Type &  message 
)
inline

Global output operator for the LogSection class.

Parameters
logsectionReference to the log section.
messageReference to the log message.
Returns
Reference to the log section.