想要在N层架构中使用Log4Net进行日志记录 [英] Want to log using Log4Net in N-tier architecture

查看:113
本文介绍了想要在N层架构中使用Log4Net进行日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我在我的应用程序中使用N-Tier架构。

包含MVC Web应用程序,代理项目,WCF服务项目,业务层项目,数据层项目。

我通过Log4Net框架记录应用程序活动。

现在日志记录适用于MVC Web应用程序和代理单独记录图层。

我使用单独的日志文件进行日志记录,我在除WCF之外的所有图层中注册了程序集。



如果可能,我想记录属于所有层的活动,包括WCF。



谢谢和问候,

RK

解决方案



看到这个链接:

http://sadi02.wordpress.com/2008/06/29/ log4net-tutorial-in-c-net-how-can-can-show-log-in-a-file / [ ^ ]



你不必将.xml文件复制到所有项目中你也可以做其他方式。


< blockquote>嗨朋友,



我通过创建一个名为log4netwrapper的独立项目来记录应用程序来解决这个问题。

我设计了一个类来读取log4net配置文件然后,我为不同的调试级别编写了一个类。

现在我将log4netwrapper dll引用到所有层并且我将配置添加到服务中。

唯一的事情困扰我的是,服务它被记录为一个文件,服务后它被记录为另一个文件。

除此之外一切都很完美。



谢谢,

RK


Hi Friends,

I am using N-Tier architecture in my application.
That consists of MVC web application, proxy project, WCF service project, business layer project, data layer project.
I am logging the application activity through Log4Net framework.
Now logging is working for MVC Web application and in proxy alone.Remaining layers are not logged.
I am using seperate log file for logging and i registered assembly in all the layer except WCF.

I want to log activity that belongs to all the layer including WCF if possible.

Thanks and Regards,
RK

解决方案

Hi,
see this link:
http://sadi02.wordpress.com/2008/06/29/log4net-tutorial-in-c-net-how-can-i-show-log-in-a-file/[^]

And u don't have to copy .xml file to all project u can do other way round also.


Hi Friends,

I solved this by creating separate project called log4netwrapper to log the application.
I designed a class to read the log4net config file then, i wrote a class for different debug levels.
Now I referenced the log4netwrapper dll to all the layer and I added configuration to service.
The only thing that bothers me is, upto service it is logged as one file and after service it is logged as another file.
Except this everything is perfect.

Thanks,
RK


这篇关于想要在N层架构中使用Log4Net进行日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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