Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to track down whats going on inside some of my components, each of which controls a custom mvc route with a custom handler.
How do I access or obtain access to the serilog logger (from within the component) which outputs to /app_data/logs? I have tried just injecting an ILogger, but that fails horribly and prevents the site from booting.
Please can you share the code as iLogger is the way to go and it worked for us.
public class ProductRouteComponent : IComponent
private readonly IDomainService _domainService;
private readonly ILogger _logger;
public ProductRouteComponent(IDomainService domainService, ILogger logger)
_domainService = domainService;
_logger = logger;
public void Initialize()
public void Terminate()
The above will fail with the following:
ystem.InvalidOperationException: Unresolved dependency [Target Type: An.Web.Components.ProductRouteComponent], [Parameter: logger(ClientDependency.Core.Logging.ILogger)], [Requested dependency: ServiceType:ClientDependency.Core.Logging.ILogger, ServiceName:]
I have also tried adding the Microsoft.Extensions.Logging.Abstractions package and used the ILogger
Hi Allan. I just had the same issue in a Surface Controller, which went away when I added this using statement: using Umbraco.Core.Logging.
Yes, as HBSequence is onto, you need to specify the correct namespace.
With the various DLLs shipping with Umbraco, there are a few different interfaces called ILogger.
From the stack trace posted, it seems that you've used ClientDependency's ILogger instead of Umbraco's ILogger.
The correct namespace is Umbraco.Core.Logging.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted