简体   繁体   English

具有.net core 2和框架包装的Log4Net

[英]Log4Net with .net core 2 and framework Wrapper

I'm prototyping a .net core 2 web application. 我正在制作.net core 2 Web应用程序的原型。 I've been asked to use Log4Net for handling our logging, but I want to put it in a .net framework 4.6.1 wrapper project as to allow for changing out the internal logging systems without having to update all of the method calls throughout the site. 我被要求使用Log4Net来处理日志记录,但是我想将其放入.net Framework 4.6.1包装项目中,以允许更改内部日志记录系统,而不必在整个过程中更新所有方法调用。现场。

Everything that I've found so far is for doing one or the other. 到目前为止,我发现的所有内容都是用于做一个或另一个。 Wrapping the log4net in 4.6.1 or doing a direct reference to the .net core. 在4.6.1中包装log4net或直接引用.net核心。

So far, my 2 main exceptions are "FileNotFoundException" for when I use it as a direct reference, or when I do the PackageReference in the Framework proejct files I get a "Logging is not compatible with netcoreapp2.0. Logging is framework 4.6.1. 到目前为止,我的两个主要例外是“ FileNotFoundException”,因为当我将其用作直接引用时,或者当我在Framework项目文件中执行PackageReference时,都会收到“日志记录与netcoreapp2.0不兼容。日志记录是框架4.6”。 1。

Please assist. 请协助。 I would love to find a way around this. 我很想找到解决这个问题的方法。

First, I would recommend making your wrapper using .NET standard 1.3 as this is the currently .NET core version supported by log4net, plus, this would allow you to reference this wrapper in .NET core and .NET framework 4.6 and up. 首先,我建议您使用.NET标准1.3进行包装,因为这是log4net支持的当前.NET核心版本,此外,这将允许您在.NET Core和.NET Framework 4.6及更高版本中引用该包装。

Second, see: https://stackify.com/making-log4net-net-core-work/ for some more info on getting log4net working with .NET core. 其次,请参阅: https ://stackify.com/making-log4net-net-core-work/有关使log4net与.NET core一起使用的更多信息。

Good luck. 祝好运。 I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM