简体   繁体   English

使用Log4net和Activator.CreateInstance

[英]using Log4net and Activator.CreateInstance

I am using log4net to log my application, 我正在使用log4net记录我的应用程序,

I have weird issue , I have some class that created dynamically using Activator.CreateInstance. 我有一个奇怪的问题,我有一些使用Activator.CreateInstance动态创建的类。

But for some reason that classes don't write the log, 但是由于某些原因,类不会写日志,

Any Idea why ? 知道为什么吗?

Perhaps Activator.CreateInstance() is choosing a different constructor for this class? 也许Activator.CreateInstance()正在为此类选择其他构造函数? I've frequently had a problem where my class has two constructors, and I forgot to get one to call : this(..) and thus my initialization logic didn't get set. 我经常遇到一个问题,我的类有两个构造函数,而我忘记了调用一个构造函数: this(..) ,因此初始化逻辑未设置。

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

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