RTC Toolkit 6.0.0
Loading...
Searching...
No Matches

Logging Facilities. More...

Files

file  logger.hpp
 Logging Support Library based on log4cplus.
 
file  logger.cpp
 Implementation of the logging methods.
 

Classes

class  rtctk::componentFramework::LogInitializer
 RAII class to clean-up logging without leaking memory. More...
 

Functions

void rtctk::componentFramework::LogConfigure (const std::string &app_name, const std::string &props_file_name)
 Performs custom logging configuration for any application.
 
void rtctk::componentFramework::LogConfigure (const std::string &app_name, log4cplus::LogLevel default_log_level=log4cplus::INFO_LOG_LEVEL)
 Performs default logging configuration for RTC Component applications.
 
void rtctk::componentFramework::LogConfigureTool (const std::string &app_name, log4cplus::LogLevel default_log_level=log4cplus::ERROR_LOG_LEVEL, bool log_to_file=false)
 Performs default logging configuration for Client Applications and Standalone Tools.
 
log4cplus::Logger & rtctk::componentFramework::GetLogger (const std::string &name="app")
 Get handle to a specific logger.
 

Detailed Description

Logging Facilities.

Function Documentation

◆ GetLogger()

log4cplus::Logger & rtctk::componentFramework::GetLogger ( const std::string & name = "app")

Get handle to a specific logger.

This is used all over the place together with the log4cplus logging macros.

The default logger is retrieved when calling GetLogger() without any further arguments

Instrument RTC developers are supposed to either use:

  • the main application logger e.g. GetLogger(), or Getlogger("app")
  • custom childloggers of the main application logger e.g. GetLogger("app.foobar")

The RTC Toolkit will use a different logger hierarchy, namely:

  • the main rtctk logger e.e. GetLogger("rtctk")
  • specific child loggers of the main rtctk logger e.g. GetLogger("rtctk.foobar")
Parameters
nameoptional: name of the requested logger
Returns
handle to the requested logger

◆ LogConfigure() [1/2]

void rtctk::componentFramework::LogConfigure ( const std::string & app_name,
const std::string & props_file_name )

Performs custom logging configuration for any application.

If a log properties file is given, the system will be configured according to this file. When creating the log properties file, take into account that the RTC Tk code logs to a "rtctk" logger and the RTC application code is supposed to log to an "app" logger. So configure loggers and appenders accordingly in your custom properties file. At a minimum, specify the "root" logger level and an appender for the root logger.

Parameters
app_namecomponent instance name or name of application (if not an RTC component)
props_file_namepathname of log4cplus properties file

◆ LogConfigure() [2/2]

void rtctk::componentFramework::LogConfigure ( const std::string & app_name,
log4cplus::LogLevel default_log_level = log4cplus::INFO_LOG_LEVEL )

Performs default logging configuration for RTC Component applications.

This method is used on default by RTC Component applications and it configures logging programmatically using RTC Tk default settings.

This means:

  • no custom properties file needs to be provided.
  • root logger logs to ryslog /var/log/elt/elt.log in cii log format, in addition
  • rtctk and app loggers log to file in $RTC_LOGS or $INTROOT/logsink in human readable format
  • rtctk and app loggers log to console in human readable format
Parameters
app_namecomponent instance name or name of application (if not an RTC component)
default_log_leveldefault log level

◆ LogConfigureTool()

void rtctk::componentFramework::LogConfigureTool ( const std::string & app_name,
log4cplus::LogLevel default_log_level = log4cplus::ERROR_LOG_LEVEL,
bool log_to_file = false )

Performs default logging configuration for Client Applications and Standalone Tools.

This method is used on default by Standalone Tools and Client Applications and it configures logging programmatically using RTC Tk default settings:

This means:

  • no custom properties file needs to be provided.
  • root logger logs to: ryslog in /var/log/elt/elt.log
  • optionally root logger also logs to console and human readable logs in $RTC_LOGS logsink
Parameters
app_namecomponent instance name or name of application (if not an RTC component)
default_log_leveldefault log level
log_to_fileoption to write logs to syslog and human readable log files