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

MuspetwonMuspetwon USMember ✭✭
edited May 1 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?

Answers

Sign In or Register to comment.