My program consists of a single EXE and 6 DLLs (and of course everyone references everyone), I currently have a crude static logging class (Logger) which is in its own DLL (Logger.dll) which I add as a reference to each of my projects and use ... but instead of re-inventing the wheel I was looking to replace this with nLog.
Problem is I can't seem to figure out how all my projects can share the same nLog config file (I want everything logging to the SAME file and I do not want to define a config file per project).
Or would it simply be best for me to wrap nLog in my static Logger.dll (odd to do but would work also) and keep doing things like I do today in my application?
Thanks,
How do you use NLog for multiple projects in the same solution? If you want to log in other projects within the solution, just reference NLog. dll directly in each of the projects and use it. But now you only need to configure NLog in your main application.
The following types can be configured: Targets - the destinations of a logevent, e.g. file, database, console. Layout - the layout e.g. json, csv, plain-text (default) Layout renderers - the template markers, e.g. ${message}, ${exception}, ${date}
Version 7. By default, the web. nlog file can be found at: C:\Program Files (x86)\Pleasant Solutions\Pleasant Password Server\www\web.
NLog should handle what you want to . The NLog.config file is applied at the application (EXE) level. So, if you configure NLog in the NLog.config, the configuration will be read when the application starts. All classes, whether in the EXE, or in one of your DLLs, when they retrieve a logger from NLog, will return a logger that has been configured according to the EXE-level NLog.config file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With