Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Nathan Woulfe 410 posts 1529 karma points MVP 3x c-trib
    Sep 23, 2019 @ 03:52
    Nathan Woulfe

    Set log destination when using ILogger

    I'm updating some old code which used Log4net's ILog as the logging interface, replacing it with Umbraco's ILogger.

    I'm registering ILogger in Autofac:

    builder.Register(c => Logger.CreateWithDefaultLog4NetConfiguration()).As<ILogger>().InstancePerRequest();

    Which then exposes methods like _logger.Error

    However, we have several custom log files written to by different processes, and I'd like to continue to do so.

    Is it possible to use the ILogger interface to write to a non-default log?

Please Sign in or register to post replies

Write your reply to: