We're trying to implement some dynamically configurable logging into our Azure application and we're using the enterprise libraries to do so which works fine, however the xml required to facilitate this is more complex than the simple 'appSetting' style setting which the ServiceConfiguration.cscfg file seems to accept in that it requires nested xml nodes,
e.g.
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
which is resolved by (forgive the formatting in this window please):
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
type="OurSolution.Common.AzureDiagnosticTraceListener, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name="AzureDiagnosticTraceListener" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.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>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="AzureDiagnosticTraceListener" />
</listeners>
</add>
</categorySources>
</loggingConfiguration>
I can't see a way of fooling the ServiceDefinition or ServiceConfiguration files to accept this, although if I could I can see a way of telling the enterprise libraries to use the ServiceConfiguration file which I can do in app.config.
Why we are trying to solve this is to allow us to dynamically adjust the settings for the logging, i.e. change from No logging to Verbose without having to do a redeploy, which is proving time consuming and impractical in our live application which has only recently gone live so may still have the odd bug present ;-)
Any thoughts would be most gratefully received Regards Kindo Malay