Forum Xamarin.Mac


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Always set MONO_LOG_LEVEL=debug and intercept debug messages inside the app

MuspetwonMuspetwon USMember ✭✭
edited May 2019 in Xamarin.Mac

I have a Xamarin.Mac application and I'd like to have more logs on how it works since some of the users complain that it crashes sporadically on their machines.

I know I can run the app from Terminal with MONO_LOG_LEVEL=debug flag so mono will write additional debug information into Terminal so it could give me some hints. However, some of the users are not really familiar with Terminal commands plus the app crashes randomly so I'd like to build the application so that it will always have MONO_LOG_LEVEL=debug enabled and it will intercept the Mono debug messages inside and write them into text file. If it is possible then the users just will run the app as always (by clicking on it in the Applications folder) and if the app crashes I can just ask them to send me the log file.

So, to rephrase my question:

  1. Is it possible to build my app so it will always be started with MONO_LOG_LEVEL=debug enabled so that I will not have to ask the users to run the app with MONO_LOG_LEVEL=debug from Terminal?
  2. If the above is possible, can I intercept the debug messages somehow inside my app and write them into log file?


Sign In or Register to comment.