RollingFlatFileTraceListener used in Web projects cause NotSupportedException

Topics: Building and extending application blocks, General discussion, Logging Application Block
Sep 7, 2015 at 1:26 PM
We use the RollingFlatFileTraceListener in a web project:

If the listener try to roll over to a new file, we get a NotSupportedException .

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"


We guess, the missing path info at the fileName attribute cause somehow a invalid path (web url notation?), details are this:

Exception Information Details:

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

StackTrace Information Details:

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



And then, too I get this errors:

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

StackTrace Information Details:

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)

Any suggestions?
Sep 9, 2015 at 9:42 AM
The problem is timeStampPattern attribute value
timeStampPattern="yyyy-MM-dd HH:mm"
Characters like : not valid for a file path.


timeStampPattern value valid can be:
timeStampPattern="yyyyMMdd_HHmm"