如何在同一解决方案中使用多个项目中的NLog [英] How to use NLog from multiple projects in the same solution

查看:415
本文介绍了如何在同一解决方案中使用多个项目中的NLog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上搜索了一个非常简单的问题.我的解决方案是一个exe(WPF)项目和四个类库.我需要一个日志记录,我喜欢NLog.如何在一个解决方案中的所有5个项目中使用它?

I searched the net for a really simple question. My solution is one exe (WPF) project and four class libraries. I need a logging and I like NLog. How can I use it from all of the 5 projects in one solution ?

我不知道,我是否需要创建(或到达某个地方)从所有项目引用的包装器类项目,并从那里使用Nlog?我看到了类似为log4Net编写的内容.

I don't know, do I need to create (or get somewhere) a wrapper class project referenced from all of the projects and use Nlog from there ? I saw something like this written for log4Net.

或者在这种情况下是否有某种模式或最佳实践?

Or is there some pattern or best practice for this scenario ?

推荐答案

仅在每个项目中直接引用NLOG并使用它.但是您只需要在主应用程序中对其进行配置.然后将自动共享配置.

Just reference NLOG directly in each of the projects and use it. But you only need to configure it in your main application. The configuration will then be shared automatically.

这篇关于如何在同一解决方案中使用多个项目中的NLog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆