Bug 10557 - Mono runtime logging not working
Summary: Mono runtime logging not working
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-02-21 18:07 UTC by Felix Collins
Modified: 2013-02-27 17:08 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Small monotouch app that should show mono runtime logging output (6.99 MB, application/zip)
2013-02-21 18:07 UTC, Felix Collins

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Felix Collins 2013-02-21 18:07:01 UTC
Created attachment 3448 [details]
Small monotouch app that should show mono runtime logging output

In the attachend project I set the EnvironmentVariables in the project settings MONO_LOG_MASK = all and MONO_LOG_LEVEL = debug. I get no log output from the runtime. On another project (our main development project) I have done the same thing and seen some output but it stops at some point and never resumes even if I do a GC.Collect() which I know should cause some output.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-02-21 20:01:00 UTC
It looks like it's just because stdout is line-cached.

Can you try adding the following to your project(s) to see if you get the expected output: https://gist.github.com/rolfbjarne/239904adb0c4a8f71e92 - remember to add a call to StartFlushing from somewhere in your code.
Comment 2 Felix Collins 2013-02-24 16:45:16 UTC
Yes that works. I can see log messages for GC on simulator and device.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-02-27 17:08:20 UTC

We now log to stderr (which is line buffered, and shows up immediately) instead of stdout in Xamarin.iOS.

The next release should have this fix, in the meantime you can use the workaround from comment 1.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-02-27 17:08:47 UTC
For the record, this is the fix: 2158f572082e3595b2146fd6c7be751188c3b8d5 (mono master).