Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, but not with the TraceListeners that ship with Enterprise-Library. What you need is a custom TraceListener or at least TraceListenerData which is used indirectly as a trace listener factory (GetCreationExpression).</p> <p>The easiers way to do what you've described is to inherit from RollingFlatFileTraceListenerData and overrice GetCreationExpression. It has this.FileName protected field which can be set to whatever you want. For example you could resolve your custom tokens (timestamp)</p> <pre><code> /// &lt;summary&gt; /// Returns a lambda expression that represents the creation of the trace listener described by this /// configuration object. /// &lt;/summary&gt; /// &lt;returns&gt;A lambda expression to create a trace listener.&lt;/returns&gt; protected override Expression&lt;Func&lt;TraceListener&gt;&gt; GetCreationExpression() { // Resolve tokens in FileName string fileName = ResolveTokens(this.FileName); return () =&gt; new RollingFlatFileTraceListener( fileName, this.Header, this.Footer, Container.ResolvedIfNotNull&lt;ILogFormatter&gt;(this.Formatter), this.RollSizeKB, this.TimeStampPattern, this.RollFileExistsBehavior, this.RollInterval, this.MaxArchivedFiles); } </code></pre> <p>And your configuration:</p> <pre><code>&lt;add name="All Activities Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Sample.CustomFlatFileTraceListenerData, Sample" fileName="%TEMP%\{timestamp}.log" footer="" formatter="Detail Text Formatter" rollFileExistsBehavior="Overwrite" rollInterval="Day" timeStampPattern="yyyy-MM-dd" maxArchivedFiles="10" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload