2013-09-25 2 views
0

Sitecore를 로깅 응용 프로그램 블록과 통합 할 수 있습니까? Log4Net 로깅을 사용하고 싶지 않습니다. Sitecore가 로깅 응용 프로그램 블록을 사용하여 로그 파일을 작성해야합니다.Sitecore와 로깅 응용 프로그램 블록

이 부분에 대한 모든 포인터는 높이 평가됩니다.

감사 J

답변

0

나는 데이터베이스에 작성하는 다음 예제를 사용했다. 데이터베이스가 있고 로그를 작성하는 일부 저장 프로 시저가 있습니다.

<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} |*****|&#xA;)}" 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 &amp; Warnings"> 
    <listeners> 
     <add name="Formatted EventLog TraceListener"/> 
    </listeners> 
    </errors> 
</specialSources> 

내가 당신을 도움이되기를 바랍니다.