1

这个问了差不多一样的问题。

我目前在 MVC 应用程序中使用城堡日志记录工具,并且当前在 global.asax 中加载单个命名记录器,这使得分隔具有相同级别的多个日志文件变得容易,而没有将相同的日志记录输出到多个文件. LoggerToMatch 是我所追求的过滤,我还有一个自定义 log4net 渲染,我目前使用单个命名记录器,我需要不同的命名记录器使用不同的自定义渲染。

我认为 Krzysztof的答案是我所追求的,但我不知道这些参数是什么 k,c。

如果有一个看起来像这样的 log4net 配置文件,我将如何使用 Windsor 重新注册两个命名记录器?到目前为止,在注册设施时,我一直在告诉 Windsor 一个名为 logger 的信息。

    <logger name="Logger1">
        <level value="INFO" />
        <appender-ref ref="ErrorRollingFile1" />
        <appender-ref ref="TraceRollingFile1" />
        <appender-ref ref="InfoRollingFile1" />
    </logger>

    <logger name="Logger2">
        <level value="INFO" />
        <appender-ref ref="ErrorRollingFile2" />
        <appender-ref ref="TraceRollingFile2" />
        <appender-ref ref="InfoRollingFile2" />
    </logger>
4

1 回答 1

0
UsingFactoryMethod((k, c)

UsingFactoryMethod gives you the possibility to access k=IKernel and c=CreationContext

through the "k" you can explicitly access&resolve components from the container(IKernel is the "kernel/core" of the container)

through "c" you have details on the parent context.

于 2013-10-02T07:57:52.437 回答