Log Viewer
Information on using the Umbraco log viewer
Umbraco ships with a built-in Log Viewer feature. This allows you to filter, view log entries, perform complex search queries, and analyze logs for debugging. You can find the Log viewer in the Settings section of the Umbraco backoffice.
Benefits
Ever needed to find all log entries containing the same request ID? Or locate all logs where a property called Duration
exceeds 1000ms?
With structured logging and a query language, you can efficiently search and identify log items for specific scenarios. This helps in debugging and finding patterns in your logs, making it easier to resolve issues.
Example Queries
Here are some example queries to help you get started. For more details on the syntax, see the https://github.com/serilog/serilog-filters-expressions project.
Find all logs that are from the namespace 'Umbraco.Core'StartsWith(SourceContext, 'Umbraco.Core')
Find all logs that have the property 'Duration' and the duration is greater than 1000msHas(Duration) and Duration > 1000
Find all logs where the message has localhost in it with SQL like@Message like '%localhost%'
Saved Searches
If you frequently use a custom query, you can save it for quick access. Type your query in the search box and click the heart icon to save it with a friendly name. Saved queries are stored in the umbracoLogViewerQuery
table in the database.
Implementing Your Own Log Viewer
Umbraco allows you to implement a customn ILogViewer
to fetch logs from alternative sources, such as Azure Table Storage.
Creating a Custom Log Viewer
To fetch logs from Azure Table Storage, implement the SerilogLogViewerSourceBase
class from Umbraco.Cms.Core.Logging.Viewer
.
Azure Table Storage requires entities to implement the ITableEntity
interface. Since Umbraco’s default log entity does not implement this, a custom entity (AzureTableLogEntity
) must be created to ensure logs are correctly fetched and stored.
Register implementation
Umbraco needs to be made aware that there is a new implementation of an ILogViewer
to register. We also need to replace the default JSON LogViewer that we ship in the core of Umbraco.
Configuring Logging to Azure Table Storage
With the above two classes, the setup is in place to view logs from an Azure Table. However, logs are not yet persisted into the Azure Table Storage account. To enable persistence, configure the Serilog logging pipeline to store logs in Azure Table Storage.
Install
Serilog.Sinks.AzureTableStorage
from NuGet.Add a new sink to
appsettings.json
with credentials to persist logs to Azure.
The following sink needs to be added to the Serilog:WriteTo
array.
For more in-depth information about logging and how to configure it, see the Logging article.
Compact Log Viewer - Desktop App
Compact Log Viewer. A desktop tool is available for viewing and querying JSON log files in the same way as the built-in Log Viewer in Umbraco.
Last updated
Was this helpful?