C++ Client and In-Process Application Logging

<< Click to Display Table of Contents >>

Navigation:  XStream® HDVR® SDK > Implementation Concepts >

C++ Client and In-Process Application Logging

Previous pageReturn to chapter overviewNext page

C++ C++ Java Java .NET .NET

Summary

 

The XStream® HDVR® SDK provides the ability to output logging data. This data can be used to evaluate the XStream HDVR SDK performance. Developers may wish to turn on logging to isolate potential issues, or at the direction of Fovia technical support staff.

 

In the C++ Client, Server, and In-Process APIs, XStream HDVR SDK logging is controlled with the ILibraryLogger abstract base class. Custom logging behavior can be implemented via inheritance from this class. The XStream HDVR SDK distribution provides source code for sample logging classes in the \Examples\libraryloggers directory. This directory contains sample logging classes for output to a file or text console. In the Java/.NET Client SDKs, file logging is supported with the hdrcServerContext.setLoggingEnabled() method.

 

C++ Client and In-Process Application Logging

 

Users of the XStream HDVR C++ Client and In-Process SDKs can turn on client application logging with the ILibrary::SetLibraryLogger() method. This method takes the address of a class object that inherits from the ILibraryLogger abstract base class. Custom logging behavior can be implemented via inheritance from this class.

 

The XStream HDVR SDK distribution provides source code for sample logging classes in the \Examples\libraryloggers directory. This directory contains class definitions for the CLibraryLoggerFile and CLibraryLoggerCout classes. These classes will output logging data to a file or text console, respectively.

 

To enable output logging, first allocate an instance of an ILibraryLogger derived class, such as the CLibraryLoggerFile class mentioned above. This class must be initialized by calling the CLibraryLoggerFile::SetLogFileRoot() and CLibraryLoggerFile::SetLogLevel() methods. The CLibraryLoggerFile::SetLogFileRoot() method sets the file name prefix that will be used for the output log file name. The output log file will be named with this prefix, and will have the thread ID for the rendering thread automatically appended to the end of the file name. The CLibraryLoggerFile::SetLogLevel() method takes an integer input parameter containing a set of bit flags indicating what logging data should be included. The available bit flags are discussed in the Logging Flags section below.

 

Once the CLibraryLoggerFile class has been initialized, it is set as the designated logging class with the ILibrary::SetLibraryLogger() method. This method takes as an input parameter the address of the ILibraryLogger derived logging class initialized as described above.

 

hdrcOpenLibrary(HDRC_SDK_VERSION, &pLibrary);

 

CLibraryLoggerFile* piLogger = new CLibraryLoggerFile(); 

piLogger->SetLogFileRoot("Logfile");

 

piLogger->SetLogLevel( 

 TO_SHOW_COMMANDS | 

 TO_SHOW_COMMAND_TIME | 

 TO_SHOW_COMMAND_ARGUMENTS | 

 TO_SHOW_COMMAND_RESULTS | 

 TO_SHOW_COMMAND_DEBUG1 | 

 TO_SHOW_COMMAND_DEBUG2 ); 

 

pLibrary->SetLibraryLogger(piLogger); 

 

Java/.NET Client Application Logging

 

Users of the XStream HDVR Java and .NET Client SDKs can turn on client application logging with the hdrcServerContex.setLoggingEnabled() method. This method takes a boolean flag that turns logging on and off, a integer representing a set a set of logging bit flags, and a string designating the log file name prefix. The available logging bit flags are discussed in the Logging Flags section below.

 

server = new hdrcServerContext("localhost", 6778);

 

int logLevel = 

 hdrcDefines.TO_SHOW_COMMANDS |

 hdrcDefines.TO_SHOW_COMMAND_TIME |

 hdrcDefines.TO_SHOW_COMMAND_ARGUMENTS |

 hdrcDefines.TO_SHOW_COMMAND_RESULTS |

 hdrcDefines.TO_SHOW_COMMAND_DEBUG1 |

 hdrcDefines.TO_SHOW_COMMAND_DEBUG2;

 

server.setLoggingEnabled(true, logLevel, "Logfile");

 

server = new hdrcServerContext("localhost", 6778);

 

int logLevel = 

 hdrcDefines.__Fields.TO_SHOW_COMMANDS |

 hdrcDefines.__Fields.TO_SHOW_COMMAND_TIME |

 hdrcDefines.__Fields.TO_SHOW_COMMAND_ARGUMENTS |

 hdrcDefines.__Fields.TO_SHOW_COMMAND_RESULTS |

 hdrcDefines.__Fields.TO_SHOW_COMMAND_DEBUG1 |

 hdrcDefines.__Fields.TO_SHOW_COMMAND_DEBUG2;

 

server.setLoggingEnabled(true, logLevel, "Logfile");

 

Server Application Logging

 

File output logging from the XStream HDVR server application is built into the application and can be turned on with command line parameters. The server application will output multiple logging files. Log files containing the word SERVER display output from threads handling client/server communication. Log files containing the word HDRC display output from threads handling one or more rendering engines.

 

The server application command line flags associated with event logging are described in the table below.

 

Parameter syntax

Purpose

Example

--logfile filename

The filename parameter designates a log file name prefix. This prefix will begin each log file name.

--logfile logData

--loglevel number

The number parameter represents a set of ENUM_TRACE_OPTIONS bit flags designating which logging fields are output. The number parameter maps internally to a 4 byte unsigned integer. The first byte is used to set logging flags for the server thread, the second byte is used to set logging flags for the render engines, the third byte is used to set logging flags for the DICOM loading thread.

 

See the Logging Flags section below for more information.

--loglevel 197379

 

The number 197379 above sets the TO_SHOW_COMMANDS and TO_SHOW_COMMAND_TIME flags for the server, rendering, and DICOM loading threads.

 

Logging Flags

 

Setting flags defined in the ENUM_TRACE_OPTIONS enumeration controls server logging actions.

 

ENUM_TRACE_OPTIONS Values

Numerical Value

Purpose

TO_SHOW_COMMANDS

1 << 0

Logs commands sent to server.

TO_SHOW_COMMAND_TIME

1 << 1

Logs time taken by to execute each command.

TO_SHOW_COMMAND_ARGUMENTS

1 << 2

Logs command arguments.

TO_SHOW_COMMAND_RESULTS

1 << 3

Logs command results.

TO_SHOW_COMMAND_DEBUG1

1 << 4

Logs basic debug info.

TO_SHOW_COMMAND_DEBUG2

1 << 5

Logs in depth debug info.

TO_SHOW_COMMAND_DEBUG3

1 << 6

Logs most verbose debug info.