However, for you there was no easy way to have the List & Label log output in the same place with your own logs. To make things more complicated, server apps typically run with separate credentials, which makes logging to file an error-prone and tedious task.
Enter the new logging interface support. It enables you to easily grab all debug output from List & Label and use your “normal” logging channel. This way, no matter if you use log4net, NLog, Boost.Log or any of the other logging libraries out there, you can get the LL output right where it belongs. This feature will be supported out of the box for .NET and C++ – support for other languages will vary with their COM and VARIANT support. This is what you’d have to implement on the .NET side for a minimal logger:
public class MyLogger : LoggerBase { public override bool WantOutput(LogLevels level, LogCategory category) { /* ... */ } public override void Debug(LogCategory category, string message, params object[] args) { /* ... */ } public override void Info(LogCategory category, string message, params object[] args) { /* ... */ } public override void Warn(LogCategory category, string message, params object[] args) { /* ... */ } public override void Error(LogCategory category, string message, params object[] args) { /* ... */ } }
Any similarities to existing logger interfaces are purely coincidential, of course ;-). We ship wrappers for NLog and log4net, so all you have to do in order to plug the LL output into your existing loggers is
ILlLogger customLogger; // use a NLog logger in List & Label customLogger = new ListLabel2NLogAdapter(NLog.LogManager.GetLogger("LL.Export")); // or use a log4net logger customLogger = new ListLabel2Log4NetAdapter(log4net.LogManager.GetLogger("LL.Export")); // or use your own implementation of ILlLogger customLogger = new MyCustomLogger(); // Pass the logger to ListLabel and everything is set up using (var LL = new ListLabel(customLogger)) { // use List & Label as usual }
Here’s a screenshot of Apache Chainsaw capturing List & Label debug output:
Besides offering the comfort of “everything in one place” this also greatly enhances the usability of List & Label logging in server applications.
And it’s yet another feature that shows our commitment to our professional dev community. 🙂