G
Guest
I'm trying to write some unit tests to prove that I understand how the
Logging Application Block works. I trying to write a test that updates the
config and then writes a log. But this is failing with the message "The
configuration section for Logging cannot be found in the configuration
source." which (I guess) indicates that the Logging Application Block isn't
seeing my config changes. Can you tell me why and/or how to make it work.
Thanks.
Here's my code:
Imports S = System.Configuration
Imports L = Microsoft.Practices.EnterpriseLibrary.Logging
Dim _Configuration As S.Configuration = _
S.ConfigurationManager.OpenExeConfiguration(S.ConfigurationUserLevel.None)
Dim _LoggingConfiguration As New L.Configuration.LoggingSettings
_Configuration.Sections.Add("loggingConfiguration", _LoggingConfiguration)
_Configuration.Save()
Dim _LogEntry As New L.LogEntry
L.Logger.Write(_LogEntry)
Logging Application Block works. I trying to write a test that updates the
config and then writes a log. But this is failing with the message "The
configuration section for Logging cannot be found in the configuration
source." which (I guess) indicates that the Logging Application Block isn't
seeing my config changes. Can you tell me why and/or how to make it work.
Thanks.
Here's my code:
Imports S = System.Configuration
Imports L = Microsoft.Practices.EnterpriseLibrary.Logging
Dim _Configuration As S.Configuration = _
S.ConfigurationManager.OpenExeConfiguration(S.ConfigurationUserLevel.None)
Dim _LoggingConfiguration As New L.Configuration.LoggingSettings
_Configuration.Sections.Add("loggingConfiguration", _LoggingConfiguration)
_Configuration.Save()
Dim _LogEntry As New L.LogEntry
L.Logger.Write(_LogEntry)