Xamarin Forms: Logging with anything from Console to SQLite

This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.And it’s also logging the invoked method name, and the file name containing the method! My Forms.RecurrenceToolkit NuGet package pack is now extended with logging functionality. You can use the pre-written Console and SQLite logger without writing much code, or you can implement your own logger in a few lines, and use it instantly simultaneous with other loggers. Install banditoth.Forms.RecurrenceToolkit.Logging.* packages, and enjoy the painless logging, and focus on the great ideas instead of being a copy paste robot. 🙂 Usage In your App.xaml.cs, initalize the logger like: The logger is including the calling method’s name, and the .cs file name in the logs. You can access the logger from anywhere by calling these methods: By default, the console and the SQLite logger logs exceptions in error level. You can implement your own logger by deriving from BaseLogger class, like: Follow for more https://github.com/banditoth/Forms.RecurrenceToolkit

.NET Core : Logging with Log4NET in .NET Core application

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.There are tons of newly created logging engines for .NET Core. Log4Net is stable, old school technology in the market. Consider using newer logging technologies, such as NLog or Serilog. But if you want to use this engine, you can make it work. Start with the Microsoft’s tutorial, “Logging in .NET Core”. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0 Install log4Net NuGet Package, and Microsoft.Extensions.Logging.Log4Net.AspNetCore package. Make changes in your Program.cs file. In the CreateHostBuilder method, configure logging with the following code: If the “AddLog4Net” method call is unrecognized by IntelliSense, make sure you have installed the Logging extension NuGet package mentioned above. Add a new file to your project, and name it log4Net.config. The template should be used is Web Configuration file. Make changes in the newly generated file, here you can configure the applications logging. I’ve skipped Console logging, Microsoft’s console logger visualize logs much greater. You can learn configuring Log4Net more at https://logging.apache.org/log4net/release/manual/configuration.htmlA quick start configuration example: