开发者

Enterprise Library Logging

开发者 https://www.devze.com 2023-02-28 21:06 出处:网络
Log file names now support the use of environment variables. You can include environment variables such as %WINDIR%, %TEMP%, and %USERPROFILE% in the Filename property of the Flat File Trace Listener,

Log file names now support the use of environment variables. You can include environment variables such as %WINDIR%, %TEMP%, and %USERPROFILE% in the Filename property of the Flat File Trace Listener, Rolling Flat File Trace Listener, and XML Trace Listener.

<add name="Trace" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Pra开发者_开发问答ctices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="Logs\trace_%DATE%.log" header="" footer="" formatter="Trace"
traceOutputOptions="None" filter="All" />

Result filename - trace_.log, what am I doing wrong?


DATE is a dynamic environment variable (i.e., one who's value can change during a session), and I don't think EL supports those.

See Add date to log file name in Logging Application Block for a possible solution, but it's not an ideal one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号