[Mono-list] Trace output to console

Jonathan Pryor jonpryor@vt.edu
15 Jan 2003 15:15:51 -0500


Already done; just:

	export MONO_TRACE=Console.Out

MONO_TRACE is somewhat more flexible.  You can specify a "prefix" which
is prefixed to all Trace/Debug messages.  For example, given the code:

	Trace.WriteLine ("Hello, World!");

If MONO_TRACE is "Console.Out:++ " then the output produced would be:

	++ Hello, World!

The prefix is everything after the `:'.

Alternatively, you can specify standard error (Console.Error, with the
same semantics for a prefix) or a log file (set MONO_TRACE to the file
name).

Alternatively, if you have a .exe.config file, you can add:

	<system.diagnostics>
		<assert logfilename="my-output.txt"/>
	</system.diagnostics>

However, this doesn't work nearly as well as I'd like due to a bug in
System.IO.FileStream (http://bugzilla.ximian.com/show_bug.cgi?id=35975).

Finally, yes, this should be documented, but I'm waiting for gtk-monodoc
to be more usable/understandable (by me) so I can add the documentation.

 - Jon

On Wed, 2003-01-15 at 14:49, J. Perkins wrote:
> Just wondering: the MS/.NET default TraceListener sends it's output to
> the IDE "Output" window in debug builds. I have found this behavior to
> be handy. Mono could do something similar by writing to the console.
> Would there be any drawbacks/objections to this? I'd prefer not to add
> Mono specific code to my projects (installing a debug TraceListener),
> even if it is just for debug builds; I would rather see it in Mono
> proper. But maybe there is a good reason to not do that.
> 
> Thanks,
> 
> Jason
> 379
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list