WCF作为服务运行的Log4Net [英] Log4Net with WCF Running As Service

查看:89
本文介绍了WCF作为服务运行的Log4Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将WCF服务作为Windows服务运行. 我无法让log4net进行任何实际的日志记录

I am running a WCF Service as Windows Service. I am having trouble getting log4net to do any actual logging

我应该将log4net的配置代码放在哪个app.config中.

In what app.config should I place my configuration code for log4net.

服务主机app.config是服务app.config还是服务调用的基础方法?

The Service Host app.config the Service app.config or the underlying methods that the Service Calls?

-b

推荐答案

在编写自己的日志记录系统时,我遇到了类似的设计问题. dll程序集的app.config无法加载.您的应用程序/服务/等的可执行文件.是加载并忽略dll配置的文件.您将必须实现自己的读/写/加载/等配置代码,或者仅将所有配置值设置到服务的app.config中(如果可能的话,更好的主意).

I've run into design issues like this when I was writing my own logging system. An app.config for a dll assembly won't load. The executable for your app/service/etc. is what loads and ignores the dll config. You will have to either implement your own read/write/load/etc config code or just set all config values into the service's app.config (much better idea if possible).

这篇关于WCF作为服务运行的Log4Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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