We are trying to implement some dynamically tunable logging in our Azure application, and we use corporate libraries for this, which works fine, but the XML code needed to facilitate this is more complicated than just setting the "appSetting" style which is ServiceConfiguration.cscfg, apparently agrees that he needs nested xml nodes,
eg.
<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 allowed (skip 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 see no way to trick ServiceDefinition or ServiceConfiguration files into accepting this, although if I could see a way to tell corporate libraries to use the ServiceConfiguration file, which I can do in app.config.
Why are we trying to solve this so that we can dynamically configure logging parameters, i.e. Change from No logging to Verbose without the need for redeployment, which proves the complexity and inappropriateness in our real application, which only recently went on the air, so there may still be an odd error; -)
Any thoughts would be greatly appreciated. Best regards Kindo Malay