0
是否有可能將Sitecore與日誌記錄應用程序塊集成?我不想使用Log4Net日誌記錄,而是Sitecore應該使用Logging應用程序塊寫入日誌文件。Sitecore與日誌記錄應用程序塊集成
對此的任何指針將不勝感激。
由於 Ĵ
是否有可能將Sitecore與日誌記錄應用程序塊集成?我不想使用Log4Net日誌記錄,而是Sitecore應該使用Logging應用程序塊寫入日誌文件。Sitecore與日誌記錄應用程序塊集成
對此的任何指針將不勝感激。
由於 Ĵ
我用下面的例子來寫入數據庫。 我有一個數據庫,和一些存儲過程來寫日誌。 的
<configuration>
<configSections>
內,你將有:
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c"/>
and after log4net section you will have :
<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add databaseInstanceName="yourDatabaseName" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c" traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c" name="DatabaseTraceListener"/>
<add source="Enterprise Library Logging" formatter="Text Formatter" log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c" traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c" name="Formatted EventLog TraceListener"/>
</listeners>
<formatters>
<add template="{dictionary({value} |*****|
)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=e623e4d8c83fe71c" name="Text Formatter"/>
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="DatabaseTraceListener"/>
</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="Formatted EventLog TraceListener"/>
</listeners>
</errors>
</specialSources>
我希望這會幫助你。