New-Logger问题?

时间:2013-05-30 14:23:09

标签: powershell log4net log4net-configuration log4net-appender

在log4net调试模式打开时,您是否知道为什么New-Logger功能不起作用? 即。当

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

当我在Trying to get log4net working with PowerShell (with a log4net config file in the mix)找到的示例代码中更改debug属性时,我得到以下跟踪:

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

0 个答案:

没有答案