0
私はエンタープライズライブラリ5.0を使用しています。流暢なインターフェースを使って、私はファイルベースとイベントベースのロギングのためにトレースリストを設定することができました。データベースのリスナーに設定できる方法はありますか?私の考えは、ロギング設定に固有の外部設定ファイルを使用しないことです。Fluent Interfaceを使用したDBログ
私は以下を使用して、フラットファイル、イベントビューアにログインできます。 DBListnerを使用してログを記録しようとすると、エラーメッセージは表示されませんが、メッセージは記録されません。誰か光を当てることはできますか?
.SendTo.RollingFile("Flat File Trace Listener")
.ToFile("Trace.log")
.WithHeader("----------------------")
.FormatWith(new FormatterBuilder()
.TextFormatterNamed("Text Formatter")
.UsingTemplate("Timestamp: {timestamp}{newline}Message: {message}{newline}Category: {category}{newline}Priority: {priority}{newline}EventId: {eventid}{newline}Severity: {severity}{newline}Title:{title}{newline}Machine: {machine}{newline}Application Domain: {appDomain}{newline}Process Id: {processId}{newline}Process Name: {processName}{newline}Win32 Thread Id: {win32ThreadId}{newline}Thread Name: {threadName}{newline}Extended Properties: {dictionary({key} - {value}{newline})}"))
.SendTo.EventLog("Formatted EventLog TraceListener")
.FormatWithSharedFormatter("Text Formatter")
.ToLog("Application")
.LogToCategoryNamed("General").WithOptions.SetAsDefaultCategory()
.SendTo.Database("Formatted Database TraceListener")
.UseDatabase("MyDatabase")
.FormatWith(new FormatterBuilder().TextFormatterNamed("TextFormat"))
.WithWriteLogStoredProcedure("WriteLog")
.WithAddCategoryStoredProcedure ("AddCategory")
.LogToCategoryNamed("DBLogger").WithOptions.SetAsDefaultCategory();
builder.ConfigureData()
.ForDatabaseNamed("MyDatabase")
.ThatIs.ASqlDatabase()
.WithConnectionString("Data Source=.\SQLExpress;Initial Catalog=Logging;Integrated ecurity=True;")
.AsDefault();