Jump to Section
LogViewer is a place that every Umbraco developer visits regularly.
It's where we diagnose issues and analyze all important events in the system.
However, sometimes the LogViewer in the Umbraco backoffice stops functioning, leaving administrators with cryptic messages such as:
- Server error: Contact administrator, see log for full details.
- Failed to retrieve log level counts.
- Failed to retrieve number of errors in logs.
- Failed to retrieve log templates.
Here is a screenshot from the Umbraco panel:
Server error: Contact administrator, see log for full details. Failed to retrieve log level counts
Server error: Contact administrator, see log for full details. Failed to retrieve number of errors in logs
Server error: Contact administrator, see log for full details. Failed to retrieve log templates
When this happens, it's nearly impossible to analyze system activity.
Our team encountered this issue sporadically during deployments on test environments when working with Umbraco 13.5.0.
After every deployment, the LogViewer would stop working until corrective actions were taken.
If you're facing similar issues, here are four ways to resolve them.
Solution 1: Remove Existing Log Files
The quickest fix often involves removing the existing log files stored in the default directory (umbraco/Logs) and restarting the application.
This method clears potential conflicts or corruption in the log files.
Steps:
- Navigate to the log directory (default: ~/umbraco/Logs).
- Delete all UmbracoTraceLog.*.json files.
- Restart the application.
TIP:
If your application is hosted on Azure, you can use the Kudu console to access and delete these files directly:
- Go to your App Service in Azure.
- Open the Advanced Tools (Kudu).
- Navigate to the LogFiles directory and delete the relevant files.
However, this solution might not always be feasible, especially if a running process locks the files, preventing deletion.
In such cases, consider other approaches.
Solution 2: Change the Logging Directory
If removing logs isn't an option or doesn't work, you can temporarily change the logging directory.
Umbraco allows you to configure the log location via the appsettings.json file.
Configuration Example:
"Umbraco": {
"CMS": {
"Logging": {
"Directory": "~/umbraco/Logs2"
}
}
If you set the configuration this way, the logs will be saved in the custom "Logs2" directory.
Steps:
- Update the logging path in the appsettings.json file.
- Restart the application.
While this workaround often resolves the issue, it’s not a permanent fix.
If the underlying issue persists, you may need to repeat the process or escalate to other methods.
Solution 3: Scale Up the Application
In some cases, scaling up your application to a higher plan temporarily resolves the issue.
This solution is particularly relevant for Azure-hosted apps, where resource contention might cause logging issues.
Steps:
- Open the Azure portal.
- Navigate to your App Service.
- Increase the plan to a higher pricing tier.
- Restart the application.
Scaling up not only resolves the logging problem but may also improve the overall performance of your application.
Solution 4: Upgrade to the Latest Version of Umbraco
Sometimes, the root cause of a problem is a bug in the version of Umbraco you're using.
Upgrading to the latest version may resolve these issues permanently.
Steps:
- Check the release notes for the latest Umbraco version to confirm if a fix is included.
- Plan and perform an upgrade of your Umbraco instance.
TIP:
Always test the upgrade process in a staging environment before applying it to production.
Important Note: If You’re Using Umbraco 10+
If your project runs on Umbraco 10 or newer, it’s crucial to be aware of potential challenges with these versions. Check out these key blog posts for insights into significant issues and updates:
- Addressing Umbraco Performance Issues: A Critical Update for Version 13 and 14
- Breaking Change to the Rich Text Editor in Umbraco 13
Staying informed can save you time and effort when troubleshooting or upgrading. Don't skip these essential reads! 🚀
Key Takeaways
LogViewer issues in Umbraco can disrupt your ability to monitor system health and diagnose errors.
By following these methods, you can try to resolve the issue:
- Remove existing log files.
- Remove corrupted lines from malformed JSON.
- Change the logging directory.
- Scale up your application.
- Upgrade to the latest version of Umbraco.
Each approach offers unique advantages, so try them in sequence to find the best one for your setup.
What's Next?
Explore our blog for more insights, and feel free to reach out for any queries or discussions related to Umbraco development.