using log4net on my project within a self-hosted WCF application z
- Add reference to log4net.dll to our console service host project (our application entry point)
Add the following line to the above project's AssemblyInfo.cs file (allows a custom log4net config file to be specified, which log4net will "watch" for updates. Quick, but maybe a bit dirty..)
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]- // LOG 4 net config
[assembly:log4net.Config.XmlConfigurator(Watch=true)] Add log4net.config file to console project and copy it to the output directory (file properties: "Copy to Output Directory")
- Add log4net.dll reference to all projects where you require logging
Declare the logger as private static member of the classes where you need logging:
private static readonly log4net.ILog Logger =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);Log where required:
Logger.Info("Starting console service host");
using log4net on my project within a self-hosted WCF application z的更多相关文章
- Code Project精彩系列(转)
Code Project精彩系列(转) Code Project精彩系列(转) Applications Crafting a C# forms Editor From scratch htt ...
- how to create an asp.net web api project in visual studio 2017
https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutoria ...
- Cocos2d-x 3.1 环境搭建和创建project
Cocos2d-x 3.x改版了非常多,之前搭过一次环境,可是没截图.这次趁着重装电脑,一边搭建一边截图.此博文仅仅是为了记录而不是为了教学,所以很多其它讲的是搭建过程.本文基本上參考这篇博客:htt ...
- YII报错笔记:<pre>PHP Notice 'yii\base\ErrorException' with message 'Uninitialized string offset: 0' in /my/test/project/iot/vendor/yiisoft/yii2/base/Model.php:778
YII常见报错笔记 报错返回的代码如下: <pre>PHP Notice 'yii\base\ErrorException' with message 'Uninitialized str ...
- Web Tab, Project Properties
https://msdn.microsoft.com/en-us/library/aa983445(v=vs.100).aspx The Web tab of the project Properti ...
- There was a conflict between
解读,首先搜索到第一个5>的开头的那一行,确认是在编译哪一个项目. 那么后面的冲突,就是在和这个项目冲突. There was a conflict between "log4net, ...
- 玩转spring boot——结合JPA事务
接着上篇 一.准备工作 修改pom.xml文件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&q ...
- 【问题】关于Mapper not initialized的问题
ERROR -- ::, [ ] nHandling.AbpApiExceptionFilterAttribute - Mapper not initialized. Call Initialize ...
- iOS系列 基础篇 01 构建HelloWorld,剖析并真机测试
iOS基础 01 构建HelloWorld,剖析并真机测试 前言: 从控制台输出HelloWorld是我们学习各种语言的第一步,也是我们人生中非常重要的一步. 多年之后,我希望我们仍能怀有学习上进的心 ...
随机推荐
- CSS中margin属性
css中margin块级元素的垂直相邻外边距会合并,比如 方框的上下外边距并不是2px,而是合并为1px了. 设置float属性就可以避免这种同级元素边距合并
- (转)linux基本变量学习:位置变量$0 、$1 shift轮替、本地变量、环境变量、特殊变量
原文:http://blog.51cto.com/woyaoxuelinux/1863045 shell: 弱类型编程语言 强:变量在使用前,必须事先声明,甚至还需要初始化: 弱:变量用时声明,甚至不 ...
- ambari-server启动出现Caused by: java.lang.RuntimeException:java.lang.ClassNotFoundEception:com.mysql.jdbc.Driver问题解决办法(图文详解)
不多说,直接上干货! 问题详解 启动ambari-server出现 Caused by: java.lang.RuntimeException:java.lang.ClassNotFoundEcept ...
- orcale 之数据操作
SQL 语句的数据操作功能是通过数据操作语言实现的,用于改变数据库中的数据.数据更新包括插入.删除和修改三种操作,与之对应的就是 INSERT. UPDATE 和 DELETE. 数据准备 创建两张表 ...
- Unity GL画折线
新建一个脚本,这个物体得挂在有摄像机组件的物体上才能生效 OnPostRender() 这个函数才会被自动调用(类似生命周期自动调用) 然后就可以代码画线了,原理是openGL的画线 using Un ...
- Ubuntu安装Python的mysqlclient
介绍 本人想在Ubuntu上开发Python程序,使用MySQL数据库. 安装环境: Ubuntu14.04 安装MySQL数据库 具体步骤如下: apt-get update apt-get ins ...
- 了解下C#异常时的输出
Sample Code: try { string re = "1.1".Substring(1,4); } catch (Exception ex) { logger.Error ...
- JVM(三) 垃圾回收时间点和垃圾收集器
收集器组合章节来自第一篇参考文章,非原创,作者总结地非常好! 分代收集相关概念来自参考文章第二篇,非原创 第二篇参考资料的文章质量很高,推荐阅读! 分代收集(Ge ...
- 如何理解animation-fill-mode及其使用?<转>
今天看了css3的动画,对animation的其他属性都比较容易理解,唯独这个animation-fill-mode让我操碎了心. 找了些下面的描述: 规定对象动画时间之外的状态. 有四个值可选,并且 ...
- es入门教程
因为项目可能会用到es保存一些非结构化的数据,并从中检索数据.对es调研了一下 从官网:https://www.elastic.co/downloads下载,解压即安装. 进入解压目录,执行bin目录 ...