combit List & Label 30 - .NET Help
Programming Introduction / Other Important Concepts / Debugging
Debugging

Problems occurring on the developer PC can be easily found in most cases. The usual features of the development environment can be used to spot a problem relatively quickly. The first step is to catch any occurring exceptions and to find their cause (see also Error Handling with Exceptions").

As a development component List & Label is naturally run under a variety of different constellations on the end user side. To find problems there as easily as possible a dedicated debug tool is available which provides a logging function for problems occurring rarely or only on certain systems so problems can also be examined under systems without a debugger. Of course the logging function can also be used on the developer PC and provides the possibility to check all calls and return values at a glance as well.

 

Create Log File

If a problem only occurs on a customer system, the first thing to do is to create a log file. The tool Debwin can be used for this purpose. It can be found in the Miscellaneous directory of the List & Label installation. Debwin has to be started before the application. By Capture List & Label Log the logging is activated. If the application is started afterwards, all calls of the component with their return values as well as additional information about module versions, operation system, etc. will be logged. Every exception thrown under .NET represents a negative value of a function in the log. There is usually more helpful information in the log, a typical output could look as follows:

...

INFO  cmLL30 LL.API 3468 14:41:30.233 >LlSelectFileDlgTitleEx(2,000A1938,'Designer',0x00008001,145F9638='''',16384,00000000)
INFO  cmLL30 LL.API 3468 14:41:31.563 <LlSelectFileDlgTitleEx() -> -99 (FFFFFF9D) (The user has terminated the operation.)
INFO  cmLL30 LL.API 3468 14:41:31.564 >LlGetErrortext(-99,14580D10,16384)
INFO  cmLL30 LL.API 3468 14:41:31.564 <LlGetErrortext() -> 0 (00000000) ['The user has terminated the operation.']
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR: Caught LL_User_Aborted_Exception (The user has terminated the operation.).
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:  Inner Exception:  ()
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:  Stack Trace:
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:     at combit.Reporting.LLException.CheckReturn(Int32 returnValue)
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:    at combit.Reporting.LlCore.LlSelectFileDlgTitleEx(IntPtr windowHandle, String title, LlProject projectType, String& projectFile)
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:    at combit.Reporting.ListLabel.DesignLabelFromRelationalDataSource(IDataProvider dataSource, String designerTitle, LlProject projectType, String projectFile, Boolean showFileSelect)
ERROR cmLL30 LL.NetFX 3468 14:41:31.584 ERR:    at combit.Reporting.ListLabel.AutoDesign(String designerTitle, LlProject projectType, String projectFile, Boolean showFileSelect)

...

First you see the type of output followed by the DLL that created the output. Then comes the location within List & Label, the thread ID and a timestamp for the output as well as the actual call with all parameters. In the following line the error code (-99) is returned as well as an explanation for it – in this case the user has aborted the file selection dialog with "Cancel”.

 

Logging in the Code

If the application is to create debug logs without the help of the Debwin tool, this can be achieved by activating debugging in the component. To do this, it is only necessary to define the two properties Debug and DebugLogFilePath accordingly.

using combit.Reporting;
...
using(ListLabel LL = new ListLabel())
{
  LL.Debug = LlDebug.Enabled | LlDebug.LogToFile;
  LL.DebugLogFilePath = @"c:\temp\myLLProtocol.log";                                 
}

 

Simply control these two debug properties with the help of AppConfig and read the desired properties from the AppConfig file of your own application in order to set them at runtime. In this way, debug logging for an application can be easily configured on site at the customer's premises without having to create and deliver the application from scratch - all that is needed is an adjustment in AppConfig.