-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use nlog in MainActivity #31
Comments
Think the question is how to acquire Microsoft Think you will find more help on Google or StackOverflow.com or some support forum for MAUI development. This repository is mostly proof that MAUI-applications can integrate with NLog. But maybe you can do this in the MainActivity-class (Just some random code found using Google): var logger = (Application as IPlatformApplication).Services.GetService<ILogger<MainActivity>>();
logger.LogInformation("Hello from MainActivity"); Ofcourse you can always just create an NLog Logger like this (using the NLog.LogManager.GetCurrentClassLogger().Info("Hello from MainActivity"); |
Thanks a lot for detailed answer. It is working. Do you know if possible to configure NLog.Targets.MauiLog to use ApplicationInsights in MAUI. I saw - example without NLog |
There is hangy.NLog.Targets.ApplicationInsights that allows NLog to integrate with ApplicationInsights using ConnectionString. But if using Microsoft ILogger, then I guess one can also just have the NLog LoggingProvider living side-by-side with the standard ApplicationInsights-LoggingProvider by Microsoft. |
Closing due to inactivity. |
Could you please explain how I get logger instance in Android MainActivity class?
The text was updated successfully, but these errors were encountered: