我需要有关Autofac.Configuration扩展的帮助!
我们使用Autofac和Autofac.Configuration将所有依赖项添加到我们的程序中。另外,我们使用system.diagnositcs跟踪来记录方法调用等(通常)。
现在,我们直到最近才开始使用Autofac.Configuration扩展名。在此之前,所有消息均按预期写入了输出文件。但是,仅通过配置文件添加的每个类都不会记录。 (它们通常工作正常,只是日志记录不起作用!)
这是我们的配置文件的外观:
"components": [
{
"type": "MyClass, MyAssembly",
"services": [
{
"type": "MyInterface, MyInterfaceAssembly"
}
],
"instanceScope": "singleinstance"
},...
这是我们的示踪呼叫的外观:
private static readonly TraceSource Tracer = new TraceSource("MyCustomName", SourceLevels.Error);
...
Tracer.TraceInformation($"SomeMessage {someInput}");
有人知道我在做什么错吗?还是这是Autofac.Configuration扩展中的错误?
Autofac.Configuration对跟踪完全不执行任何操作。如果您search through the source甚至都没有引用到那里的任何地方。
我的猜测是发生了其他事情。我会在你的鞋子里看的东西:
[很遗憾,您是didn't include a minimal reproducible example,因此任何人都无法真正帮助您进行故障排除。但是,我可以100%保证由于Autofac.Configuration模块中的任何错误,跟踪不会失败。这将是另外一回事-您创建的JSON配置错误或发生了其他无关的更改。