A simple trick to get more information out of the Sitecore logs
Recently, I was struggling with one particular Sitecore site that was taking too much time to load in my development environment. Sometimes I would think that it just got stuck and then I would try restarting the application pool or even running an
This article shows a quick tip if you want to get more out of the Sitecore logs by doing a simple trick: enabling the DEBUG level.
Still on that particular Sitecore site, whenever I looked at the Sitecore logs, I noticed that the log wrote something like the following and then it stopped.
ManagedPoolThread #3 15:58:25 INFO Trying to load XML configuration /App_Config/Security/Domains.config
Or sometimes, it would stop at the following entry.
12968 15:40:30 INFO HttpModule is being initialized
That would make me think that there was something wrong with the Domains.config file or with some HttpModule during the initialization.
Then I remembered that
Sitecore.Logging works similarly to log4net, and by default Sitecore.Logging uses the INFO logging level.
Just for the sake of curiosity, altough Sitecore.Logging uses the same namespace as log4net and works similar to it, Sitecore.Logging has no dependency on log4net. Having that said, some features in log4net are not available in Sitecore.Logging. Please, see this question I posted on Sitecore Stack Exchange for more information.
All I had to do in order to get more information was to enable the DEBUG level. To enable DEGUG level, just add a patch file with the following content.
After enabling that, I could get more information out of the Sitecore logging and see that my Sitecore instance was still running some process and logging information but on a DEBUG level.
ManagedPoolThread #3 15:58:25 INFO Trying to load XML configuration /App_Config/Security/Domains.config 10684 15:58:25 DEBUG [Sitecore Mvc]: Profile > Method InitializeRoutes.RegisterAreas - duration 2053ms 10684 15:58:25 DEBUG [Sitecore Mvc]: PrecompiledViewAssembly (Sitecore.Mvc) loaded, contains 0 CSHTML mappings 10684 15:58:25 DEBUG [Sitecore Mvc]: PrecompiledViewAssembly (Sitecore.Speak.Components.Web) loaded, contains 112 CSHTML mappings 10684 15:58:25 DEBUG [Sitecore Mvc]: PrecompiledViewAssembly (Sitecore.Speak.Web) loaded, contains 193 CSHTML mappings
What was wrong with that site? Well… let’s say that it is still a work in progress…