0

WindowsアプリケーションへのログインにEnterpriseLibrary5 Loggingブロックを使用しています。また、データベーストレースリスナーを定義するときに、ログエントリにいくつかの拡張プロパティを定義し、それを使用してメッセージをログに記録します。拡張プロパティはどこに保存されますか?どの分野で?

4

1 に答える 1

1

拡張プロパティは、すぐに使用できるデータベーストレースリスナーを使用して、別の列またはテーブルにログインしません。

拡張プロパティをログに記録するには、拡張プロパティをログに記録するフォーマッターを構成します。

        <formatters>
            <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter"/>
        </formatters>

次に、拡張プロパティデータがFormattedMessage列に記録されます。

これの欠点は、拡張プロパティがFormattedMessageに埋め込まれていることです。拡張プロパティのより構造化された表現が必要な場合は、カスタムデータベーストレースリスナーを作成できます。

拡張プロパティを別のテーブルに記録する例については、カスタム例外ハンドラを使用した拡張プロパティトレースリスナーを参照してください。

于 2013-01-28T14:59:17.757 に答える