Wednesday, June 10, 2009

Enabling Sitecore CMS6 logging in tests

I ran into an issue when writing unit tests code that used the Sitecore CMS6 Sitecore.Disagnostics.Log class. My App.config had a log4net section but nothing was being logged to the appenders.
Using reflector I found out the Sitecore.Diagnostics.Log.Enabled returns Sitecore.Configuration.Settings.ConfigurationIsSet. So I added the configSection:

<section name="sitecore" type="Sitecore.Configuration.ConfigReader, Sitecore.Kernel" />

and a stub sitecore section to get things working.