Valid from List & Label 8
Capturing log messages from List & Label using Debwin and the integrated log file writer are simple and convenient solutions for regular desktop applications. However, for web applications, Windows services and multi-user systems this approach is of a very limited usefulness: Debwin and the integrated log file capture the log messages from all List & Label instances of a process and there is no separation between the outputs of concurrently running print jobs. For those scenarios implementing a custom logging mechanism or using one of the popular logging frameworks like NLog or log4net becomes advisable. For that purpose, create a new class deriving from LoggerBase or implementing the ILlLogger interface directly. Passing such a logger object to the constructor of the ListLabel object will cause all log ouputs of this specific List & Label job to be sent to the specified logger. You may then filter the messages by different levels (Debug, Information, Warning and Error) and categories (e.g. data provider, .NET component, printer information, …). The included sample project "C# Custom Logger Sample" contains examples of an own logger implementation as well as adapters which connect the prevalent logging frameworks NLog and log4net with the logging interface of List & Label.
Example: Redirecting log output to NLog:
ILogger nlogLogger = NLog.LogManager.GetLogger("MyApp.Reporting");
ILlLogger llLogger = new ListLabel2NLogAdapter(nlogLogger);
ListLabel LL = new ListLabel(llLogger);
Please note:
- The properties "Debug" and "DebugLogFilePath" of the ListLabel class are ignored as soon as a custom logger is passed to the constructor.
- To avoid a strong decrease in performance, reduce the log outputs in your ILlLogger implementation to the minimum using the WantOutput() method.
- Most of the included data providers (optionally) also support an external logger object. Those data providers implement the ISupportsLogger interface and provide a SetLogger() method. If a data provider is not assigned a custom logger object, it inherits the logger of the ListLabel object.
Tip for NLog: Often log outputs appear as sudden bursts. Use the AsyncWrapper target of NLog for an async processing of the log messages so List & Label does not have to wait on it.
Until Version 21:
In previous version when using List & Label within a service, call LlSetDebug as follows to get debug information:LlSetDebug(LL_DEBUG_CMBTLL | LL_DEBUG_CMBTLL_LOGTOFILE)
Any debug messages will now be logged to the combit.log file in your %APPDATA% (prior version 13: Windows) directory. The pipe character (|) is a symbol for the “or” operator. Please use the “or” operator of your programming language.
Related articles:
KBTE000752
IDKBTE000531 KBTE000531