This project is read-only.
Project Description
NLogConfig simplifies programmatic NLog configuration for extensions written for extensible applications such as Visual Studio.

Wanting to add logging capabilities for debugging and troubleshooting to several Visual Studio extensions, and settling on NLog to fulfill that service, I found it difficult to configure NLog to do the job. Part of the problem is that NLog is normally configured through a program's app.config file, which does not apply to plug-ins. Another is that plug-ins run within Visual Studio's application domain, so it turned out that if multiple plug-ins run within Visual Studio, it was possible that logging information intended for one plug-in might end up in the log written for a completely different plug-in.

An obvious solution for this is to do programmatic configuration for the plug-in in question. There are however a number of settings that have to be set for NLog, and forgetting any one setting, can keep NLog from working as intended.

I decided that it would be best to write a wrapper for NLog to make some of this work a little easier, making some compromises for the sake of simplicity. One compromise for example is choosing to store log files within application directories under a user's AppData\Roaming directory. When NLogConfig is initialized a user specifies a company name, an application name, and a log file directory, and using that information NLogConfig builds a path for the log files in this format:


Target and rule instances may be built using the provided factory methods, or they can be created directly using the NLog configuration API, and then plugged into an NLogConfig object for it to handle.

Right now at the start there are only a few factory methods written, but I intend to add more as time goes on. There are other enhancements that are really needed, that will have to wait as well. But we think that NLogConfig already fills a niche that has been begging to be filled for a while.

We hope you may give it a try, and give us your ideas to make this a more useful tool.

Last edited Sep 26, 2014 at 1:22 AM by gloder, version 2