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
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted