Configuring log4net with VS2010 and .Net 4.0
2013-04-23 23:12
176 查看
Configuring log4net with VS2010 and .Net 4.0
After spending a few hours this morning trying to get log4net working with a project, I decided to share my findings. I chased a lot of dead-ends for what wound up being a fairly simple solution. Here is a quick article to save both myself, and maybe you, some time in the future.Get Log4Net
Go to http://logging.apache.org/log4net/ and get the latest version. Add the project file to your solution. Then right-click that project, choose the build tab and…Step 1: Set the log4net conditional compilation symbols replacing NET_1_0 with NET_4_0.
Log4Net Requires Full .Net Access
That means you cannot use “client profile”. log4net was originally written to log web services. As such it expects to have a lot of server-side classes available, even though most of those classes are never instantiated.Step 2: Build Your Application & The Log4Net component under .Net 4.0, not .Net 4.0 Client Profile
Make Log4Net Less Secure
The .Net 4.0 assemblies are more secure by default. You need to override this. As I’m not a .Net development guru I’m not really certain what the differences mean, but Google is your friend (and mine) here, so if you are concerned (and you should be before launching a public app) then search the Internet to find out what this mean. In the meantime…Step 3: Make log4net assembly less secure, add
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
to the log4net AssemblyInfo.cs file.
Done.
That’s it, the first steps for getting a log4net component into your application. Now you can follow some of the development & deployment document on the Apache site:http://logging.apache.org/log4net/release/manual/configuration.html
编译好的for .net 4.0 的log4net库文件下载:
log4net for .net 4.0 : http://files.cnblogs.com/sgsoft/log4Net_4.0.zip
相关文章推荐
- Configuring log4net with VS2010 and .Net 4.0
- Configuring log4net with VS2010 and .Net 4.0
- .net framework 4.0 在 VS2010 安装目录下位置 dotNetFx40_Full_x86_x64.exe在磁盘哪个目录?
- VS2010使用.net 4.0中的ASP.NET MVC 2 模板建立工程后无法提交HTML代码解决方案一则
- HMAC MD5 http://hmacmd5.codeplex.com HMAC-MD5 for .NET 4.0, SL4 and WP7 Silverlight Windows Phone
- VS2010和.net Framework 4.0 下载
- 微软发布VS2010和.net Framework 4.0社区技术预览版
- ASP.NET MVC 2.0 in Vs2010 :使用C# 4.0中使用动态类型来传递ViewData
- Fix for Internet Explorer 11 and ASP.NET 4.0
- dhl:IIS注册ASP.NET 1.1、2.0、4.0_在win7下如果先安装vs2010 后安装iis7的话,必须注册iis才可以用。~~~!!鄙视微软
- Usage of keywords "in" and "out" in C#(.NET 4.0)
- ASP.NET MVC 2.0 in Vs2010 :使用C# 4.0中使用动态类型来传递ViewData
- Searching and Navigating Code in VS 2010 (VS 2010 and .NET 4.0 Series)
- Microsoft Visual Studio 2010 and the .NET Framework 4.0 CTP下载
- [转]URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series)
- VS2010使用.net 4.0中的ASP.NET MVC 2 模板建立工程后无法提交HTML代码解决方案一则
- 详解VS2010部署之基于.NET Framework 4.0程序的部署解决方案
- enable all verbs to application hosting on IIS 7.5 and using Asp.net 4.0
- What is the difference between .NET 1.1,2.0,3.0,3.5 and 4.0
- ASP.NET MVC 2.0 in Vs2010 :使用C# 4.0中使用动态类型来传递ViewData