JONATHAN LUELLEN
JONATHAN LUELLEN

Reputation: 78

How to log at a debug or trace level for a component that is part of a Waveform

I am working with Redhawk 1.9.

I have a waveform that has two components (both in C++). They communicate to each other via a message. I want to log data at a debug level to show that the data is being passed correctly between the components. I launched the Domain and Device Managers from the IDE with logging at the debug level. I then launched the waveform and start both components. The Device Manager console display information from the component if it was logged at Info level or printed out via std::cout.

Is it possible to log at the debug or trace level for a particular component in a waveform. That is when the waveform is launched from the IDE.

Upvotes: 0

Views: 520

Answers (2)

Youssef Bagoulla
Youssef Bagoulla

Reputation: 1247

When the logging level of the domain and device manager is set within the IDE, as well as when setting the log level with the nodeBooter -debug flag, it only effects the verboseness of the Domain and Device managers themselves. The components, waveforms, etc continue to output only up to INFO I believe.

In order to have your components output at a non-default logging level to the console, you must provide a log4j configuration file to nodeBooter instance running the device manager that is executing your component. You can find a short introduction to log4j configuration files here: http://logging.apache.org/log4j/1.2/manual.html

A simple example of a log4j configuration file that will pass DEBUG level log messages to the console is:

log4j.rootLogger=DEBUG,LOGFILE

log4j.appender.LOGFILE=org.apache.log4j.ConsoleAppender log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout

This file's location must be passed into nodeBooter like this:

nodeBooter -d /nodes/DevMgr_localhost/DeviceManager.dcd.xml -logcfgfile /home/ylb/exampleDevLogFile.log4j

There are many other configuration options you can provide from within your log4j configuration file so that the log is written to a file in addition to the console and log4j can provide log rotation, max log file size checking, formatting etc.

Keep in mind that this means you are launching your domain and device manager via the command line instead of through the IDE so you'll simply have to connect your IDE to the already launched domain/device manager through the "New Domain Connection" dialog.

Upvotes: 0

Adam Anderson
Adam Anderson

Reputation: 156

You can add a "long" type property to your component with an ID of "DEBUG_LEVEL". Check the "execparam" box kind. This will allow you to edit that specific Components debug level on launch by setting the default property value as a digit 1-5 with:

  • 5: TRACE
  • 4: DEBUG
  • 3: INFO
  • 2: WARN
  • 1: ERROR

Upvotes: 2

Related Questions