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
Umbraco's Log Viewer uses structured logging and a query language, so you can search for specific scenarios instead of scanning raw text. For example, finding every log entry tied to one request ID, or every entry where Duration exceeds 1000ms. This makes debugging and pattern-spotting easier.
Example Queries
Here are some example queries to help you get started. For more details on the syntax, see the 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 1000ms
Has(Duration) and Duration > 1000Find 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 custom 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.
The connection string above must match the one used by the Serilog sink configured in Configuring Logging to Azure Table Storage. If the two point at different storage accounts, this repository queries a table that was never written to. The Log Viewer then fails with an error stating the table does not exist. Read the connection string from configuration rather than hardcoding it, so both sides always agree.
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.AzureTableStoragefrom NuGet.Add a new sink to
appsettings.jsonwith credentials to persist logs to Azure.
The following sink needs to be added to the Serilog:WriteTo array.
This example uses the same Azurite-compatible connection string as the repository above, so the two stay in sync for local testing.
Replace it with your real Azure Storage connection string when deploying, for example: DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=KEY;EndpointSuffix=core.windows.net. Update the repository's connection string to match.
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?