2015-09-07 106 views
0

我们使用RollingFlatFileTraceListener在Web项目:RollingFlatFileTraceListener导致NotSupportedException异常

如果监听尝试翻转到一个新的文件,我们得到了一个N​​otSupportedException异常。

NAME = “SeguridadFileListener”

 fileName="C:\Logs\Portal2015\Seguridad.log" 
    footer="----------------------" 
    formatter="TimeStampAndMessage Formatter" 
    header="" 
    rollFileExistsBehavior="Overwrite" 
    rollInterval="None" 
    rollSizeKB="2048" 
    timeStampPattern="yyyy-MM-dd HH:mm" 
    traceOutputOptions="None" 
    filter="All" 

我们猜测,在文件名失踪的路径信息属性导致总得无效的路径(?网页URL记号),细节是这样的:

异常信息详情:

Exception Type: System.NotSupportedException 
Message: The given path's format is not supported. 
Data: System.Collections.ListDictionaryInternal 
TargetSite: System.String CanonicalizePath(System.String, Boolean) 
HelpLink: NULL 
Source: mscorlib 

堆栈跟踪信息详情:

at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) 
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) 

,然后嫌我得到这个错误:

Exception Type: System.NullReferenceException 
Message: Referencia a objeto no establecida como instancia de un objeto. 
Data: System.Collections.ListDictionaryInternal 
TargetSite: Void PerformRoll(System.DateTime) 
HelpLink: NULL 
Source: Microsoft.Practices.EnterpriseLibrary.Logging 
HResult: -2147467261 

堆栈跟踪信息详情:

en Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.PerformRoll(DateTime rollDateTime) 
    en Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.RollIfNecessary() 
    en Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data) 
    en Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.TraceListenerWrapper.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data) 
    en Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter, TraceEventCache traceEventCache) 
    en Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl.ProcessLog(LogEntry log, TraceEventCache traceEventCache) 

有什么建议?

回答

1

问题是timeStampPattern属性

timeStampPattern="yyyy-MM-dd HH:mm" 

字符,如无效的文件路径。

timeStampPattern值有效的可以是:

timeStampPattern="yyyyMMdd_HHmm" 
相关问题