Logging framework on Xamarin iOS
Solution 1
Logging on iOS is a bit different than logging on a desktop/server application, as the user has no (easy) way to retrieve the logs.
There are multiple options though:
-
For your own debugging purposes:
use
System.Console.WriteLine()
. That's equivalent to Obj-CNSLog
-
For remote logging:
use a third party framework e.g.
TestFlight SDK (for beta testing, but there's a private beta for production builds as well)
Crashlytics
Some solutions even provide remote logging, so you can have access to crash reports and device logs.
It goes without saying that you can use most of these frameworks from Xamarin.iOS, check https://github.com/mono/monotouch-bindings
Solution 2
I think you can use Xamarin Insights for logging. Xamarin Insights
Solution 3
I forked Apache log4net and made it compile under MonoTouch with some essential appenders. Expect bugs since it's not fully tested, but it's a start.
Solution 4
Crittercism just released an official crash reporting and logging framework for Xamarin (Full disclosure: I'm one of the co-founders). It has full support for automatically logging unhandled exceptions and signals (signals like SIGSEGV are handled gracefully by letting the Mono runtime handle them and pass the full stacktrace to Crittercism). You can also send any logs to Crittercism as well using handled exception logging. You can download it from the Xamarin store here:
Adam
Updated on July 10, 2022Comments
-
Adam almost 2 years
What's the state of logging on
Xamarin.iOS
(using Xamarin Studio Indie).I've tried using
NLog
, but it referencesSystem.ServiceModel
- so Xamarin complains that I need business edition (not paying that much just to useNLog!
)log4net also doesn't work, because it references classes in
System.Configuration
that don't exist inXamarin/MonoTouch
.I find it surprising that there isn't a logging solution available, either in with XS, or by the major logging players.
What am missing?
-
Jakub Bielan about 9 years
-
Jakub Bielan about 9 yearsFor remote logging Xamarin Insights is good option: developer.xamarin.com/guides/cross-platform/insights/…