Open Sourcing our Logging Tool Debwin

Here’s another addition to our open source zoo on GitHub – we’ve released the source code for our logging application Debwin under an MIT license. Just head over to GitHub. Here is the original announcement of the app from 2016, detailing a number of features.

Besides logging the debug output from List & Label or the Report Server, it can be used as a generic UDP packet logger that listens for incoming messages on a freely configurable UDP port. You can also parse the incoming messages, a sample parser for Log4J packets is included. 

Many of you are familiar with Debwin4, as it is a frequent part of our support process to ask for log files created this way. Actually, you should start to add logging to your own application today, if you’re not doing it already. It’s easy once you have List & Label in your application. The most basic usage is the LlDebugOutput API, that allows the output of simple strings. If you want to get more sophisticated – here’s a sample how to add logging to your custom IDataProvider implementation:

Simply add the  ISupportsLogger interface to your data provider implementation. It has a single method:

void SetLogger(ILlLogger logger, bool overrideExisting);

The ILlLogger interface is the interesting part – you can issue debug, info, warning and error messages:

public interface ILlLogger
{
	bool WantOutput(LogLevels level, LogCategory category);
	void Debug(LogCategory category, [Localizable(false)] string message, params object[] args);
	void Debug(int indentationDelta, LogCategory category, [Localizable(false)] string message, params object[] args);
	void Info(LogCategory category, [Localizable(false)] string message, params object[] args);
	void Info(int indentationDelta, LogCategory category, [Localizable(false)] string message, params object[] args);
	void Warn(LogCategory category, [Localizable(false)] string message, params object[] args);
	void Error(LogCategory category, [Localizable(false)] string message, params object[] args);
}

In the logger app Debwin you can then filter for the required log level:

If you want to log from other parts of your application, you can get an ILlLogger interface anytime, by using the static LoggingHelper.LlCoreDebugOutputLogger property like so:

LoggingHelper.LlCoreDebugOutputLogger.Error(LogCategory.Net, "Server connection error ({0}): {1}", response.StatusCode.ToString(), response.Result);

Adding logging to an application “in the wild” is a no-brainer for any serious development – and if the logging app doesn’t have all the features you require for an analysis, you can start contributing today. We’d be happy to receive pull requests for the project.

Related Posts

Leave a Comment