Cisco Cisco Computer Telephony Integration OS 8.5 Guide Du Développeur
B-8
CTI OS Developer’s Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted
Release 8.0(1)
Appendix B CTI OS Logging
Logging and Tracing (.NET)
Creating a Custom Logging Mechanism
The LogManager class within the .NET CIL implements all CIL logging functions. This singleton class
has only one instance of LogManager, which provides a global point of access. The LogManager object
defines a LogEventHandler delegate that must be implemented by custom applications:
has only one instance of LogManager, which provides a global point of access. The LogManager object
defines a LogEventHandler delegate that must be implemented by custom applications:
public delegate void LogEventHandler(object eventSender, LogEventArgs args);
How to Log Trace Events Using the Logger Class
To log trace events from a custom application to a file, perform the following steps:
Step 1
Create a Logger object. For example:
m_log = new Logger();
Step 2
Write a method to handle log events. This method can trace the log events to a file, if desired. For
example:
example:
public virtual void ProcessLogEvent(Object eventSender, LogEventArgs Evt)
{
// Output the trace
String traceLine = Evt.Description;
// Check that tracing is enabled for this tracelevel
if ( m_logger.IsTraceMaskEnabled(traceLevel) )
{
WriteTraceLineToFile(traceLine);
}
}
Step 3
Create a log listener to handle trace events. In the following example, the AddLogListener method
registers the LogEventHandler delegate as a listener for trace events. The LogManager will send trace
events to the method that you pass to the LogEventHandler.
registers the LogEventHandler delegate as a listener for trace events. The LogManager will send trace
events to the method that you pass to the LogEventHandler.
In the following example, the LogManager will send trace events to the ProcessLogEvent method created
in Step 2.
in Step 2.
m_log.AddLogListener(new LogManager.LogEventHandler(ProcessLogEvent));
Note
The LogManager only calls the method passed as a parameter to the LogEventHandler for a particular
trace if the trace level for that trace is enabled. You can use the IsTraceMaskEnabled method in the
Logger class to determine whether or not a trace level is enabled.
trace if the trace level for that trace is enabled. You can use the IsTraceMaskEnabled method in the
Logger class to determine whether or not a trace level is enabled.
Configuring Tracing (Java and .NET)
For the Java and .NET CILs, you can configure tracing either programmatically by using the
LogWrapper class or by editing the TraceConfig.cfg file. Settings in TraceConfig.cfg will not take effect
until LogWrapper.ProcessConfigFile is called. Your application must call ProcessConfigFile if you have
edited the configuration settings in the TraceConfig.cfg file.
LogWrapper class or by editing the TraceConfig.cfg file. Settings in TraceConfig.cfg will not take effect
until LogWrapper.ProcessConfigFile is called. Your application must call ProcessConfigFile if you have
edited the configuration settings in the TraceConfig.cfg file.
The All Agents Sample .NET code in the .NET CIL includes a sample TraceConfig.cfg file and shows
how to process that file.
how to process that file.
Log file configuration settings are defined as follows
Table B-6
Configuration Settings