[Mono-list] LAMESPEC?: System.Diagnostics.DiagnosticsConfigurationHandler

Pablo Baena pbaena@uol.com.ar
21 May 2003 04:51:13 +0000


--=-38EJI1ndl0W0U7nVRfJI
Content-Type: multipart/alternative; boundary="=-3YrIOLJhCt2Ol0LXB+0/"


--=-3YrIOLJhCt2Ol0LXB+0/
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Could you apply this patch? It took so long 'cause I was trying to
replicate .NET behaviour. It seems that .NET doesn't remove the
DefaultTraceListener anyway, and I didn't get help in any list about
this.

At least it works in Mono.

On Sat, 2003-05-17 at 14:48, Jonathan Pryor wrote:

> Go ahead and fix it.  It doesn't seem to be a particularly lame
> requirement, as not everyone will expect the default TraceListener to be
> named "Default" (case sensitive).
> 
> Could you also update the test cases in
> class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs?
> 
>  - Jon
> 
> On Sat, 2003-05-17 at 06:42, Pablo Baena wrote:
> > In Mono's
> > System.Diagnostics.DiagnosticsConfigurationHandler.AddTraceListeners
> > (), "name" and "type" are required. On the other hand, MSDN
> > documentation for System.Diagnostics.DefaultTraceListener says that:
> > 
> > <configuration>
> > <system.diagnostics>
> >     <trace autoflush="false" indentsize="4">
> >         <listeners>
> >            <remove
> > type="System.Diagnostics.DefaultTraceListener,System"/> 
> >         </listeners>
> >     </trace>
> > </system.diagnostics>
> > </configuration>
> > 
> > should remove the DefaultTraceListener (apparently without specifying
> > the name).
> > 
> > Thus, that sample .config file throws an exception on Mono.
> > 
> > I can fix this. Should I?
> > 
> > -- 
> > Pablo Baena <pbaena@uol.com.ar>
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

-- 
Pablo Baena <pbaena@uol.com.ar>

--=-3YrIOLJhCt2Ol0LXB+0/
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.1.10">
</HEAD>
<BODY>
Could you apply this patch? It took so long 'cause I was trying to replicate .NET behaviour. It seems that .NET doesn't remove the DefaultTraceListener anyway, and I didn't get help in any list about this.<BR>
<BR>
At least it works in Mono.<BR>
<BR>
On Sat, 2003-05-17 at 14:48, Jonathan Pryor wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373" SIZE="3"><I>Go ahead and fix it.  It doesn't seem to be a particularly lame
requirement, as not everyone will expect the default TraceListener to be
named &quot;Default&quot; (case sensitive).

Could you also update the test cases in
class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs?

 - Jon

On Sat, 2003-05-17 at 06:42, Pablo Baena wrote:
&gt; In Mono's
&gt; System.Diagnostics.DiagnosticsConfigurationHandler.AddTraceListeners
&gt; (), &quot;name&quot; and &quot;type&quot; are required. On the other hand, MSDN
&gt; documentation for System.Diagnostics.DefaultTraceListener says that:
&gt; 
&gt; &lt;configuration&gt;
&gt; &lt;system.diagnostics&gt;
&gt;     &lt;trace autoflush=&quot;false&quot; indentsize=&quot;4&quot;&gt;
&gt;         &lt;listeners&gt;
&gt;            &lt;remove
&gt; type=&quot;System.Diagnostics.DefaultTraceListener,System&quot;/&gt; 
&gt;         &lt;/listeners&gt;
&gt;     &lt;/trace&gt;
&gt; &lt;/system.diagnostics&gt;
&gt; &lt;/configuration&gt;
&gt; 
&gt; should remove the DefaultTraceListener (apparently without specifying
&gt; the name).
&gt; 
&gt; Thus, that sample .config file throws an exception on Mono.
&gt; 
&gt; I can fix this. Should I?
&gt; 
&gt; -- 
&gt; Pablo Baena &lt;pbaena@uol.com.ar&gt;

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com</FONT>
<A HREF="http://lists.ximian.com/mailman/listinfo/mono-list"><FONT SIZE="3">http://lists.ximian.com/mailman/listinfo/mono-list</I></FONT></A></PRE>
</BLOCKQUOTE>
<PRE><TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Pablo Baena &lt;<A HREF="mailto:pbaena@uol.com.ar">pbaena@uol.com.ar</A>&gt;
</TD>
</TR>
</TABLE>
</PRE>
</BODY>
</HTML>

--=-3YrIOLJhCt2Ol0LXB+0/--

--=-38EJI1ndl0W0U7nVRfJI
Content-Disposition: attachment; filename=deftrace_listener.patch
Content-Type: text/plain; name=deftrace_listener.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

? class/ByteFX.Data/.makefrag
? class/ByteFX.Data/.response
? class/ByteFX.Data/library-deps.stamp
? class/Commons.Xml.Relaxng/.makefrag
? class/Commons.Xml.Relaxng/.response
? class/Commons.Xml.Relaxng/library-deps.stamp
? class/ICSharpCode.SharpZipLib/.makefrag
? class/ICSharpCode.SharpZipLib/.response
? class/ICSharpCode.SharpZipLib/library-deps.stamp
? class/Microsoft.VisualC/.makefrag
? class/Microsoft.VisualC/.response
? class/Microsoft.VisualC/library-deps.stamp
? class/Mono.Data.DB2Client/.makefrag
? class/Mono.Data.DB2Client/.response
? class/Mono.Data.DB2Client/library-deps.stamp
? class/Mono.Posix/.makefrag
? class/Mono.Posix/.response
? class/Mono.Posix/library-deps.stamp
? class/Mono.Security/.makefrag
? class/Mono.Security/.response
? class/Mono.Security/library-deps.stamp
? class/Npgsql/.makefrag
? class/Npgsql/.response
? class/Npgsql/library-deps.stamp
? class/PEAPI/.makefrag
? class/PEAPI/.response
? class/PEAPI/library-deps.stamp
? class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs-back
? class/System/Test/.makefrag
? class/System/Test/.response
? class/System/Test/TestResult.xml
? class/System/Test/argument.txt
? class/System/Test/library-deps.stamp
? class/System.Data.OracleClient/.makefrag
? class/System.Data.OracleClient/.response
? class/System.Data.OracleClient/library-deps.stamp
? class/System.Design/.makefrag
? class/System.Design/.response
? class/System.Design/library-deps.stamp
? class/System.Management/.makefrag
? class/System.Management/.response
? class/System.Management/library-deps.stamp
? class/System.Security/.makefrag
? class/System.Security/.response
? class/System.Security/library-deps.stamp
? class/System.Security/Test/.makefrag
? class/System.Security/Test/.response
? class/System.Security/Test/library-deps.stamp
? class/System.Security/Test/security_linux_test.dll
? class/System.XML/Test/.makefrag
? class/System.XML/Test/.response
? class/System.XML/Test/TestResult.xml
? class/System.XML/Test/library-deps.stamp
? class/System.XML/Test/XmlFiles/xsl/result.xml
? class/corlib/Test/TestResult.xml
? class/corlib/Test/library-deps.stamp
? nunit20/framework/.makefrag
? nunit20/framework/.response
? nunit20/framework/library-deps.stamp
? nunit20/nunit-console/.makefrag-exe
? nunit20/nunit-console/.response-exe
? nunit20/nunit-console/program-deps
? nunit20/util/.makefrag
? nunit20/util/.response
? nunit20/util/library-deps.stamp
Index: class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
===================================================================
RCS file: /mono/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs,v
retrieving revision 1.5
diff -u -r1.5 DiagnosticsConfigurationHandler.cs
--- class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs	21 Dec 2002 03:38:12 -0000	1.5
+++ class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs	21 May 2003 07:47:11 -0000
@@ -233,8 +233,13 @@
 							AddTraceListener (name, type, id);
 							break;
 						case "remove":
-							name = GetAttribute (attributes, "name", true, child);
-							RemoveTraceListener (name);
+							name = GetAttribute (attributes, "name", false, child);
+							if (name == null) {
+								type = GetAttribute (attributes, "type", true, child);
+								RemoveTraceListener (Type.GetType (type));
+							}
+							else
+								RemoveTraceListener (name);
 							break;
 						case "clear":
 							TraceImpl.Listeners.Clear ();
@@ -282,6 +287,15 @@
 				throw new ConfigurationException (
 						string.Format ("Unknown error removing listener: {0}", name),
 						e);
+			}
+		}
+
+		private void RemoveTraceListener (Type type)
+		{
+			// .NET apparently ignores other types
+			if (type == typeof (DefaultTraceListener))
+			{
+				RemoveTraceListener ("Default");
 			}
 		}
 
Index: class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
===================================================================
RCS file: /mono/mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs,v
retrieving revision 1.3
diff -u -r1.3 DiagnosticsConfigurationHandlerTest.cs
--- class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs	25 Mar 2003 08:37:23 -0000	1.3
+++ class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs	21 May 2003 07:47:13 -0000
@@ -196,7 +196,8 @@
 				"<remove name=\"foo\"/>",
 				"<add name=\"foo\"" +
 					"type=\"System.Diagnostics.TextWriterTraceListener, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />",
-				"<remove name=\"foo\"/>"
+				"<remove name=\"foo\"/>",
+				"<remove type=\"System.Diagnostics.DefaultTraceListener\"/>"
 			};
 			ValidateSuccess ("#TTT:L:Good", format, good);
 

--=-38EJI1ndl0W0U7nVRfJI--