Skip to content

Instantly share code, notes, and snippets.

@kjellski
Created September 2, 2013 13:01
Show Gist options
  • Save kjellski/6412608 to your computer and use it in GitHub Desktop.
Save kjellski/6412608 to your computer and use it in GitHub Desktop.
web.config referencing Logging config
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
source="Enterprise Library Logging" formatter="Complete Text Formatter"
log="" machineName="." traceOutputOptions="None" />
<add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="logs/trace.log" header="" footer="" formatter="Complete Text Formatter" />
<add name="Remotelabs Information Rolling File Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="logs/remotelabs_information.log" footer="" formatter="Complete Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Year" />
<add name="Remotelabs Error Rolling Flat File Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="logs/remotelabs_error.log" footer="" formatter="Complete Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Year" />
<add name="Remotelabs Week Complete Log Rolling Flat File Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="logs/remotelabs_complete.log" footer="" formatter="Complete Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Week"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, Callstack" />
<add name="Remotelabs Warning Rolling Flat File Trace Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="logs/remotelabs_warning.log" footer="" formatter="Complete Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Week" />
</listeners>
<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}&#xA;Message: {message}&#xA;Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:{title}&#xA;Machine: {localMachine}&#xA;App Domain: {localAppDomain}&#xA;ProcessId: {localProcessId}&#xA;Process Name: {localProcessName}&#xA;Thread Name: {threadName}&#xA;Win32 ThreadId:{win32ThreadId}&#xA;Extended Properties: {dictionary({key} - {value})}"
name="Text Formatter" />
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="{timestamp(FixedFormatISOInternationalDate)} {timestamp(FixedFormatTime)} {severity}{tab}[{eventid}] &quot;{title}&quot; {message}"
name="Complete Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Remotelabs Week Complete Log Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="ActivityTracing" name="Trace">
<listeners>
<add name="Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="RemotelabsInformationLog">
<listeners>
<add name="Remotelabs Information Rolling File Trace Listener" />
<add name="Remotelabs Week Complete Log Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="RemotelabsErrorLog">
<listeners>
<add name="Remotelabs Error Rolling Flat File Trace Listener" />
<add name="Remotelabs Week Complete Log Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="RemotelabsWarningLog">
<listeners>
<add name="Remotelabs Week Complete Log Rolling Flat File Trace Listener" />
<add name="Remotelabs Warning Rolling Flat 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 &amp; Warnings">
<listeners>
<add name="Event Log Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
</configuration>
<configuration>
<configSections>
<section name="loggingConfiguration" configSource="RLUtils.Logging.config"/>
...
</configSections>
...
</configuration>
@chilversc
Copy link

This should be:

<configuration>
  <configSections>
    <section name="loggingConfiguration"/>
  </configSections>

  <loggingConfiguration configSource="RLUtils.Logging.config"/>
</configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment