Tag: common.logging

NLog使用NLog.config动态更改文件名

如何使用C#中的变量动态更改FileName? 我的想法是创建一个日志文件,如Log__${date:format=yyyy-MM-dd}.log 。 有任何想法吗?

无法从配置部分’common / logging’获取Common.Logging的配置

我正在尝试使用以下日志记录程序集配置控制台应用程序: Common.Logging.dll(2.1.0.0) Common.Logging.Log4Net1211.dll(2.1.0.0) log4net.dll(1.2.11.0) 如果以编程方式配置记录器,那么一切正常: NameValueCollection properties = new NameValueCollection(); properties[“showDateTime”] = “true”; Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(properties); 但是,如果我尝试使用以下配置文件启动它,它会爆炸: 这些是相关的错误消息: {“Unable to cast object of type ‘System.Configuration.DefaultSection’ to type ‘System.Configuration.AppSettingsSection’.”} {“Failed obtaining configuration for Common.Logging from configuration section ‘common/logging’.”} 它似乎无法解析我的配置文件,是否有人知道正确的格式应该是什么,或者是其他错误的东西? 我使用官方文档创建了配置文件。