In the Breaking Changes in CMS 11, it is no longer supported to get an ILogger instance from the IOC container. But if your solution
There is an alternative way is using LogManager to get ILogger Instance https://world.episerver.com/documentation/developer-guides/CMS/logging/
But if you've recently upgrade your solution to CMS 11 and there is a lot of code using injected ILogger from IoC container. You don't want to change this, let use the below code
public static void Configure(IContainer container)
{
container.Configure(
x =>
{
x.Scan(y =>
{
y.TheCallingAssembly();
y.LookForRegistries();
y.WithDefaultConventions();
});
x.For<ILogger>().AlwaysUnique().Use(context => LogManager.GetLogger(context.ParentType ?? context.RootType));
});
}
Please sign in to leave a comment.