Bug 26648 - Debug class logs message multiple times
Summary: Debug class logs message multiple times
Status: RESOLVED DUPLICATE of bug 13538
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: master
Hardware: PC Windows
: High normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-02 13:26 UTC by Mikayla Hutchinson [MSFT]
Modified: 2016-02-13 09:04 UTC (History)
7 users (show)

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


Attachments

Description Mikayla Hutchinson [MSFT] 2015-02-02 13:26:37 UTC
DefaultTraceListener logs to Debugger.Log:

https://github.com/mono/mono/blob/effa4c07ba850bedbe1ff54b2a5df281c058ebcb/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs#L266


DefaultTraceListener in the MOBILE profile is hardcoded to also log to Console.Out:

https://github.com/mono/mono/blob/effa4c07ba850bedbe1ff54b2a5df281c058ebcb/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs#L78

This leads to trace messages (Debug.WriteLine etc) showing up twice in the application output.
Comment 1 Nate Cook 2015-02-03 11:22:08 UTC
I look forward to seeing this one fixed.
Comment 2 Gabe Johnson 2015-02-22 18:54:54 UTC
Any progress on this one? I'm about ready to write my own post-processing script so I can read the output more clearly.

Ideally the Debug.WriteLine output could be piped to a different stream, that way the timestamp and such isn't mixed in.
Comment 3 David Karlaš 2015-07-24 10:21:41 UTC

*** This bug has been marked as a duplicate of bug 13538 ***
Comment 4 renan jegouzo 2016-02-13 09:04:08 UTC
on iOS I found a trick 
I was using System.Diagnostics.Debug.Print(..)  that display twice
but System.Console.WriteLine(..) display only once

so just create
public class Debug
{
	[ Conditional("DEBUG") ]
	public static void Print (string s)
	{
		System.Console.WriteLine(s);
	}
}
and call this class, not Diagnostics one

Note You need to log in before you can comment on or make changes to this bug.