0

你知道为什么当 log4net 调试模式打开时 New-Logger 功能不起作用吗?IE。什么时候

<log4net debug="true">
...
</log4net>

当我在尝试让 log4net 与 PowerShell 一起工作(混合使用 log4net 配置文件)中找到的示例代码中更改调试属性时,我得到以下跟踪:

log4net: Configuration update mode [Merge].
log4net: Logger [root] Level string is [ALL].
log4net: Logger [root] level set to [name="ALL",value=-2147483648].
log4net: Loading Appender [LogFileAppender] type: [log4net.Appender.FileAppender]
log4net: Setting Property [File] to String value [C:\Users\XXX\Documents\Snippets\LOGS\LogTest2.txt]
log4net: Setting Property [AppendToFile] to Boolean value [True]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [ConversionPattern] to String value [%date [%thread] %-5level %logger [%ndc] - %message%newline]
log4net: Converter [date] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [thread] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [] ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [level] Option [] Format [min=5,max=2147483647,leftAlign=True]
log4net: Converter [literal] Option [ ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [logger] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [ [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [ndc] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [literal] Option [] - ] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [message] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Converter [newline] Option [] Format [min=-1,max=2147483647,leftAlign=False]
log4net: Setting Property [Layout] to object [log4net.Layout.PatternLayout]
log4net: Opening file for writing [C:\Users\XXX\Documents\Snippets\LOGS\LogTest2.txt] append [True]
log4net: reated Appender [LogFileAppender]
log4net: Adding appender named [LogFileAppender] to logger [root].
log4net: Retrieving an instance of log4net.Repository.Logger for logger [new-presentation].
log4net: Setting [new-presentation] additivity to [True].
log4net: Logger [new-presentation] Level string is [ALL].
log4net: Logger [new-presentation] level set to [name="ALL",value=-2147483648].
log4net: Adding appender named [LogFileAppender] to logger [new-presentation].
log4net: Hierarchy Threshold []
Method invocation failed because [System.Object[]] doesn't contain a method named 'Info'.
At C:\Users\XXX\Documents\Snippets\Sample.ps1:58 char:10
+ $Log.Info <<<< ($MsgTable.StartMsg)
+ CategoryInfo          : InvalidOperation: (Info:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [System.Object[]] doesn't contain a method named 'Info'.
At C:\Users\XXX\Documents\Snippets\Sample.ps1:68 char:10
+ $Log.Info <<<< ($MsgTable.StopMsg)
+ CategoryInfo          : InvalidOperation: (Info:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
4

0 回答 0