Enterprise Library 5.0 Logging を使用すると、ログが不安定になります。
この問題は、負荷分散された構成の Windows 2008 R2 サーバーで実行されている IIS (7.5) でホストされている WCF 4.0 アプリケーションに関係しています。依存性注入に Unity (2.0) を使用しています。ローリング テキスト ファイルにログを記録するようにライブラリを構成しました。アプリケーションは AppFabricCache を使用します。
サービスをホストしている Web アプリケーションを再起動した後の最初の数回の呼び出しで、ロギングが成功したようです。その後、それ以上のロギングは見られません。構成でエラーが発生したか、テキスト ファイルへの出力の書き込み/フラッシュで競合が発生している可能性があります。Logging クラスがスレッドセーフな方法で動作することを理解しています。
以下は、構成ファイルの関連部分です。どんな考えでも大歓迎です。ありがとう。
<loggingConfiguration name="loggingConfiguration" tracingEnabled="true" defaultCategory="General">
<listeners>
<add name="Rolling File Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="d:\SOMEPATH\Logs\trace.log"
formatter="Text Formatter"
header="" footer=""
timeStampPattern="yyyy-MM-dd hh:mm:ss.fff"
traceOutputOptions="None"
maxArchivedFiles="2000"
rollFileExistsBehavior="Increment" rollInterval="Day" rollSizeKB="1024" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="{timestamp(yyyyMMdd HH:mm:ss.fff)} - {message}"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Rolling File Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Rolling File Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>