EMANE  1.2.1
Log Service

The LogServiceProvider is used by components to log output messages.

Issuing a Log Message

The LogServiceProvider is accessed via the PlatformServiceProvider. All components are given a reference to the PlatformServiceProvider when they are constructed.

There are two types of logging macros: standard and verbose. The only difference between the standard and verbose macro forms are that verbose macros can be compiled out using the –without-verbose-logging configure option.

pReceivePropertiesControlMessage =
static_cast<const Controls::ReceivePropertiesControlMessage *>(pControlMessage);
LOGGER_VERBOSE_LOGGING_FN_VARGS(pPlatformService_->logService(),
Controls::ReceivePropertiesControlMessageFormatter(pReceivePropertiesControlMessage),
"MACI %03hu RFPipe::%s Receiver Properties Control Message",
id_,
__func__);

The Logger is designed to be lightweight especially when the current log level does not permit a log message to be emitted. However, it may be useful to analyze model performance without any go-path log statements.

It is a best practice to use the standard form of log macros for all life cycle related logging and error reporting. Use the verbose form of log macros for per-packet (go-path) debug logging.

Use LOGGER_STANDARD_LOGGING_FN, LOGGER_STANDARD_LOGGING_FN_VARGS, LOGGER_VERBOSE_LOGGING_FN and LOGGER_VERBOSE_LOGGING_FN_VARGS whenever you want to create a log message string using a function or method and print the resulting string as a "%s". These macros are smart enough to not execute callables unless the current log level is set to allow the message to be emitted.

Log Levels

Log messages are assigned one of four log levels:

  • ABORT_LEVEL - Used to emit an abort message prior to throwing an exception that will terminate the emulator.
  • ERROR_LEVEL - Used to emit an error message. Errors are considered worthy of reporting but not significant enough to terminate the emulator.
  • INFO_LEVEL - Used to emit informational messages concerning configuration item values.
  • DEBUG_LEVEL - Used to emit the kitchen sink.

It is a best practice to only log INFO_LEVEL messages from Component::configure and RunningStateMutable::processConfiguration. INFO_LEVEL log messages should contain configuration item name and value information.

bPromiscuousMode_ = item.second[0].asBool();
LOGGER_STANDARD_LOGGING(pPlatformService_->logService(),
"MACI %03hu %s::%s %s = %s",
id_,
pzLayerName,
__func__,
item.first.c_str(),
bPromiscuousMode_ ? "on" : "off");

Logging, more specifically over logging, can have a significant impact on emulation model performance. It is never advisable to run the emulator with a log level greater than INFO_LEVEL (command line level 3) unless you are debugging.

$ emane platform.xml -l 3
10:35:22.591338  INFO application: emane -l 3 platform.xml 
10:35:22.591526  INFO application uuid: fcdf297b-38b7-49b2-903e-b3412f20b051
10:35:22.591544 ERROR Please consider using the realtime scheduler to improve fidelity.
10:35:22.607130  INFO MACI 001 RFPipeMACLayer::configure datarate = 10000
10:35:22.607206  INFO MACI 001 RFPipeMACLayer::configure delay = 1.500000
10:35:22.607245  INFO MACI 001 RFPipeMACLayer::configure enablepromiscuousmode = off
10:35:22.607275  INFO MACI 001 RFPipeMACLayer::configure flowcontrolenable = off
10:35:22.607301  INFO MACI 001 RFPipeMACLayer::configure flowcontroltokens = 10
10:35:22.607333  INFO MACI 001 RFPipeMACLayer::configure jitter = 1.000000
10:35:22.607350  INFO MACI 001 RFPipeMACLayer::configure pcrcurveuri = rfpipepcr.xml
10:35:22.607363  INFO MACI 001 RFPipeMACLayer::configure neighbormetricdeletetime = 60.000000
10:35:22.607383  INFO MACI 001 RFPipeMACLayer::configure radiometricenable = off
10:35:22.607398  INFO MACI 001 RFPipeMACLayer::configure radiometricreportinterval = 1.000000
10:35:22.607716  INFO PHYI 001 FrameworkPHY::configure: bandwidth = 1000000 Hz
10:35:22.607760  INFO PHYI 001 FrameworkPHY::configure: fixedantennagain = 0.00 dBi
10:35:22.607780  INFO PHYI 001 FrameworkPHY::configure: fixedantennagainenable = on
10:35:22.607794  INFO PHYI 001 FrameworkPHY::configure: noisebinsize = 20 usec
10:35:22.607816  INFO PHYI 001 FrameworkPHY::configure: noisemaxmessagepropagation = 200000 usec
10:35:22.607829  INFO PHYI 001 FrameworkPHY::configure: noisemaxsegmentduration = 1000000 usec
10:35:22.607841  INFO PHYI 001 FrameworkPHY::configure: noisemaxsegmentoffset = 300000 usec
10:35:22.607856  INFO PHYI 001 FrameworkPHY::configure: noisemode = all
10:35:22.607871  INFO PHYI 001 FrameworkPHY::configure: propagationmodel = precomputed
10:35:22.607884  INFO PHYI 001 FrameworkPHY::configure: subid = 2
10:35:22.607906  INFO PHYI 001 FrameworkPHY::configure: systemnoisefigure = 4.00 dB
10:35:22.607918  INFO PHYI 001 FrameworkPHY::configure: txpower = 0.00 dBm
10:35:22.607927  INFO PHYI 001 FrameworkPHY::configure: frequency = 2347000000 Hz
10:35:22.607939  INFO PHYI 001 FrameworkPHY::configure: frequencyofinterest = 2347000000 Hz
10:35:22.607948  INFO PHYI 001 FrameworkPHY::configure: noisemaxclampenable = off
10:35:22.607956  INFO PHYI 001 FrameworkPHY::configure: timesyncthreshold = 10000 usec
10:35:22.737387  INFO NEM  001 NEMImpl::configure platformendpoint: 127.0.0.1/8181
10:35:22.737452  INFO NEM  001 NEMImpl::configure transportendpoint: 127.0.0.1/8171