Logging in Voice Elements

⌘K
  1. Home
  2. Programmable Voice
  3. Introduction to Using Voi...
  4. Logging in Voice Elements

Logging in Voice Elements

When troubleshooting issues in Voice Elements applications, customers can utilize the VoiceElements.Common.Log class. The class provides a simple interface which allows you to create a log file and log application events in several different ways; you can write a simple string, a string with an application-provided identifier, or even include current call stack frame with the message.

Use of the Log class can help with the technical support process, should you encounter issues when developing or running your application. When you contact Inventive Labs technical support, you’ll be asked to provide logs from your server. While the Voice Elements and HMP Elements server logs can provide useful information, application logs are often more helpful in tracking down problems.

What to Log

As the application developer, you can write any information which you find useful using the Log class. However, there are several items which we recommend to be logged for the purpose of troubleshooting:

  • User-defined function entry and exit. Logging the entry and exit of your functions can help provide scope to your logs, providing context to errors which are logged.
  • Exceptions. Most Voice Elements methods generate exceptions when errors occur and should be called from withing try/catch blocks. The exceptions generated contain descriptive messages which should be logged.
  • Any user-provided input. User input via speech recognition or DTMF can control the flow of the application; logging of the input can be useful if the application doesn’t follow the expected execution path.

Many application logic issues can be discovered with this general logging. Complex issues may require additional logging to be instrumented to target specific actions.

Using the Log Class

Basic usage of the VoiceElements.Common.Log class is straight-forward. It is generally recommended to store a single instance of the Log in a static variable in your application. You can then use a reference to it for logging globally. The Log constructor accepts a single parameter, the path and name of the file to open or create.

 
VoiceElements.Common.Log s_Log = new VoiceElements.Common.Log(“IVRLog.log”); 

Write Method

To write information to the log, use one of the Write methods, depending on your needs.

 
try 
{ 
     m_VoiceResource.PlayTTS(“Thank you for calling Inventive Labs.”)
}
catch(Exception e) 
{ 
     s_Log.Write(“Error playing TTS message: “ + e.Message); 
} 

CloseLog Method

Your log should be closed using the CloseLog method before exiting the application, if possible.

 
s_Log.CloseLog(); 

Performance Impact

While there is the potential for a performance impact due to logging, in most cases it is negligible. As an example, HMP Elements logs the full contents all SIP messages sent and received; on a high-density system running 1000 ports, it has been found to have little impact on performance. The logging the information suggested will not perceptively add to this.

Summary

Logging at the application level can greatly aid in the troubleshooting process. While the platform logs (Voice Elements and HMP Elements servers) contain a great deal of useful information, they provide little insight into the application’s logic. This information is extremely useful in isolating where and why an application’s call flow deviates from what is expected. While this may all seem obvious, it is not uncommon for this logging to be unimplemented.

Do you still have questions? If so, please contact Inventive Labs technical support.

 

Was this article helpful to you? No Yes 16

How can we help?