# Litium 7.7.8 breaking change

**URL:** <https://forum.litium.com/t/litium-7-7-8-breaking-change/2546>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [April 21, 2022, 7:33am UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546 "2022-04-21T07:33:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/samuel/32/479_2.png) [@samuel](https://forum.litium.com/u/samuel)\
**Post date:** [April 21, 2022, 7:33am UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/1 "2022-04-21T07:33:30Z")

</div>

Continuing the discussion from [Litium 7.7.8 is released](https://forum.litium.com/t/litium-7-7-8-is-released/2545):

From 59989 - Logging improvements  
“If you implemented your own Litium.Owin.Logging.ILog provider the provider need to be changed to use the Microsoft Logging Extension provider.”

We’ve inherited the code for our Litium solution and I’m not sure how our logging is built. @patric.forsgard Do you have any suggestion what to look for in the code to know if we have our own implementation of a Litium.Owin.Logging.ILog provider?

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [April 21, 2022, 8:33am UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/2 "2022-04-21T08:33:39Z")

</div>

What’s you background for the change in the default implementation?

What you need to do is to implement your own `Microsoft.Extensions.Logging.ILoggerProvider` that will be registered as an logger provider, example

```nohighlight
    public class MyLogger : Microsoft.Extensions.Logging.ILogger
    {
        public MyLogger(string categoryName)
        {
        }

        public IDisposable BeginScope<TState>(TState state)
        {
            throw new NotImplementedException();
        }

        public bool IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel)
        {
            throw new NotImplementedException();
        }

        public void Log<TState>(Microsoft.Extensions.Logging.LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
        {
            throw new NotImplementedException();
        }
    }

    public class MyLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider
    {
        public Microsoft.Extensions.Logging.ILogger CreateLogger(string categoryName)
        {
            return new MyLogger(categoryName);
        }

        public void Dispose()
        {
        }
    }

    public class MyLoggingProviderConfiguration : Litium.Runtime.IApplicationConfiguration
    {
        public void Configure(ApplicationConfigurationBuilder app)
        {
            app.ConfigureServices(services =>
            {
                services.AddLogging(configure =>
                {
                    configure.AddProvider(new MyLoggerProvider());
                });
            });
        }
    }

```

In many cases common logging providers already have implementation for the Microsoft Logging Extensions and then they can be used directly, see the links in the bug.

---

<div class="post-metadata">

**Author:** ![samuel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/samuel/32/479_2.png) [@samuel](https://forum.litium.com/u/samuel)\
**Post date:** [April 21, 2022, 9:07am UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/3 "2022-04-21T09:07:11Z")

</div>

My question was how we would know if we are affected by the breaking change.

We’re using NLog.ILogger directly to write logs but we don’t have a custom implementation of the interface. Does that mean that we’re in the clear? Or do we need to change all usage of NLog.ILogger to use Microsoft.Extensions.Logging.ILogger instead?

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [April 21, 2022, 10:11am UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/4 "2022-04-21T10:11:47Z")

</div>

If you have implemented your own logger that implements the `Litium.Owin.Logging.ILog` you will have new member-methods that need to be implemented and getting build errors; otherwise your code is not affected.

Using `NLog.LogManager.GetLogger(cateogryName)` is still possible and that will work as before, Litium still using Nlog for as the logging provider and all log record will end up in the same place.

To be better _future compatible_ you should stop using NLog directly and instead inject the `Microsoft.Extensions.Logging.ILogger` into your implementations, then the logging will be configured in one place and can easy be changed to another logging provider without a need to change the caller code.

---

<div class="post-metadata">

**Author:** ![samuel](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/samuel/32/479_2.png) [@samuel](https://forum.litium.com/u/samuel)\
**Post date:** [April 21, 2022, 12:38pm UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/5 "2022-04-21T12:38:22Z")

</div>

Thank you for the clarification @patric.forsgard. 👍

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [May 19, 2022, 12:38pm UTC](https://forum.litium.com/t/litium-7-7-8-breaking-change/2546/6 "2022-05-19T12:38:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
