Orleans: Orleans migrate to Microsoft.Extensions.Logging abstraction in 2.0

Created on 15 Aug 2017  路  5Comments  路  Source: dotnet/orleans

Why migrating to Microsoft.Extensions.Logging ?

Orleans logging has been an old feature with us through the cold and muddy early days. It was introduced as a way to pipe Orleans runtime logging to external log consumers and also an ability to configure multiple ILogConsumer to the system. But now Net.Core team has released something equivalent and better to .Net Standard eco system: Microsoft.Extensions.Logging. So we decided to migrate to it in Orleans 2.0.

What is Microsoft.Extensions.Logging ?

It provides the common wrapper which everyone has to write if they want to configure their application with multiple types of loggers. This wrapper provides one set of APIs that are then forwarded to a provider of your choosing. Net.Core team developed a set of built-in providers and also collaborated with various logging framework teams (including third parties like NLog, Serilog, Loggr, Log4Net and more) so that there are Microsoft.Extensions.Logging compatible providers from them, too. To know more, please see this and this.

How logging would be like in Orleans 2.0

Microsoft.Extensions.Logging abstraction doesn't completely cover all Orleans logging features. So some feature will be replaced by Microsoft.Extensions.Logging, some will be deprecated, and some will be removed in 2.0. Here is the current plan:

Remove in 2.0

  • [x] Change logger's trace level in runtime through SiloControl.
  • [x] Change SystemLogLevel and AppLogLevel through SiloControl

Replaced by Microsoft.Extensions.Logging in 2.0

  • [x] Orleans.Runtime.LogManager, as the configuration component, will be replaced by its counterpart in Microsoft.Extensions.Logging, which is ILoggerFactory (Completed in #3333)
  • [x] Orleans.Runtime.LoggerType, which brings the ability to define your logger type, will be covered by Log filtering

Deprecated features in 2.0

  • [x] Orleans.Runtime.ILogConsumer
  • [x] Orleans.Runtime.Severity, including its configuration part.
  • [x] Orleans.Runtime.Logger, its extension methods, and Logger GetLogger(string) methods from runtime and grain base class.

We plan to release an extension package to support the deprecated logging features in a way which is compatible with Microsoft.Extensions.Logging. PR #3284 is an prototype for it.

Message bulking feature, which provides the ability to only log error code count if the same error code has appeared too many times in an interval, will be continuing supported in a Microsoft.Extensions.Logging compatible way, thanks to its ability to bring performance gain. See PR #3284 for more information.

In short, Microsoft.Extensions.Logging will be integrated into Orleans as its suggested logging solution in 2.0. Most orleans logging infra will be replaced by it. Features which Orleans logging currently supports, but not supported in Microsoft.Extensions.Logging will either be deprecated or removed.

Let me know if you have any concerns.

Most helpful comment

that's awesome ! it actually worked !

mind my bad joke. ofc we tested it before we release. ;)

All 5 comments

This is part of "Reorganize Orleans packages and project structure" #3353 effort

Excellent! With 2.0 TP4 - successfully integrated single-homed logging from an ASP.Net Core project fronting an Orleans host.

that's awesome ! it actually worked !

mind my bad joke. ofc we tested it before we release. ;)

Well I hope it is reassuring that there are strange people who monitor this type of thing and try stuff out on your random builds!

We should be done with this one.

Was this page helpful?
0 / 5 - 0 ratings