A package for viewing Umbraco trace logs in 6 and 7
Previously all logs were generated in the database inside the umbracoLog table. However, this new class logs to plain text files which are rotated daily and stored in the /App_Data/Logs/ folder within your Umbraco site. If you look in there you should see a file called UmbracoTraceLog.txt. This is the current log file, whilst the older files with a date suffix are the historical logs.
Anatomy Of a Log File
If you open the UmbracoTraceLog.txt file you will see it's just a plain text file that contains log entries that look similar to the following:
2013-06-23 17:39:00,021  INFO Umbraco.Core.CoreBootManager - [Thread 5] Umbraco application starting 2013-06-23 17:39:00,039  INFO Umbraco.Core.PluginManager - [Thread 5] Determining hash of code files on disk 2013-06-23 17:39:00,044  INFO Umbraco.Core.PluginManager - [Thread 5] Hash determined (took 4ms) 2013-06-23 17:39:00,203  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of Umbraco.Core.PropertyEditors.IPropertyEditorValueConverter, found 0 (took 151ms) 2013-06-23 17:39:00,209  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of Umbraco.Web.Mvc.SurfaceController, found 0 (took 2ms) 2013-06-23 17:39:00,218  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of Umbraco.Core.Media.IThumbnailProvider, found 3 (took 2ms) 2013-06-23 17:39:00,220  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of Umbraco.Core.Media.IImageUrlProvider, found 1 (took 1ms) 2013-06-23 17:39:00,240  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of umbraco.interfaces.IApplicationStartupHandler, found 8 (took 3ms) 2013-06-23 17:39:00,286  INFO Umbraco.Core.CoreBootManager - [Thread 5] Umbraco application startup complete (took 262ms) 2013-06-23 17:39:00,294  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of umbraco.interfaces.IApplication, found 7 (took 5ms) 2013-06-23 17:39:00,451  INFO Umbraco.Core.PluginManager - [Thread 5] Completed resolution of types of umbraco.interfaces.ITree, found 27 (took 3ms) 2013-06-23 17:39:00,774  ERROR Umbraco.Web.UmbracoApplication - [Thread 5] An unhandled exception occurred System.ApplicationException: The current httpContext can only be set once during a request. at Umbraco.Web.UmbracoContext.set_Current(UmbracoContext value) at Umbraco.Web.UmbracoContext.EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, Boolean replaceContext) at Umbraco.Web.UmbracoModule.BeginRequest(HttpContextBase httpContext) at Umbraco.Web.UmbracoModule.b__6(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 2013-06-23 17:39:06,414  INFO Umbraco.Web.UmbracoApplication - [Thread 5] Application shutdown. Reason: HostingEnvironment
As you can see, log files contain the following information for each entry:
- The date and time of the log entry
- A number in square brackets that has something to do with the thread that was running (?)
- The name of the .NET type that generated the log entry (ie. the name of the class from within which the call to write to the log was made)
- The logging level (ie. INFO, WARNING, ERROR)
- Another thread reference (?)
- The message being logged (which, in the case of an error, may be an exception stack trace)
The format of this log is defined in /config/log4net.config and can be tweaked there.
Whilst these log files are quite easily human readable, they aren't viewable from within Umbraco itself. That means to view them you need to have direct access to the server and to the /App_Data/Logs/ folder within your site. Another drawback of the new format is that they aren't easily sortable or filterable - in fact, the new log file format isn't at all easy to parse since the fields and entries are not delimitted in any way.
Introducing Diplo Trace Log Viewer
To get around the problem of not being able to (easily) view log files I've written a small Umbraco package that installs itself into the Developer tree (in Umbraco 7) or as a Dashboard panel (in Umbraco 6). It allows you to select, view, sort, filter and search log files.
Umbraco 7 Version
Umbraco 6 Version
Give Me The Download!!!!!
You can download and install the package (it's free!) from http://our.umbraco.org/projects/developer-tools/diplo-trace-log-viewer
If you are really nosey you can get the source code (for the Umbraco 7 version) on GitHub.
Note: The latest version (2.x) has been rewritten from scratch for Umbraco 7 using AngularJS and WebApi controllers.
Also note I have another log viewer package for the umbracoLog table data - Diplo Audit Log Viewer.