[Mono-bugs] [Bug 343790] New: System.Diagnostics.NullEventLog. ModifyOverflowPolicy System.NotSupportedException
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Nov 23 07:23:28 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=343790
Summary: System.Diagnostics.NullEventLog.ModifyOverflowPolicy
System.NotSupportedException
Product: Mono: Class Libraries
Version: SVN
Platform: i686
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at ximian.com
ReportedBy: surfzoid2002 at yahoo.fr
QAContact: mono-bugs at ximian.com
Found By: DeveloperNet
Trying to use the Windows logger, seem work execpt the policy :
Unhandled Exception: System.NotSupportedException: This EventLog implementation
does not support modifying overflow policy
at System.Diagnostics.NullEventLog.ModifyOverflowPolicy (OverflowAction
action, Int32 retentionDays) [0x00000]
at System.Diagnostics.EventLog.ModifyOverflowPolicy (OverflowAction action,
Int32 retentionDays) [0x00000]
at (wrapper remoting-invoke-with-check)
System.Diagnostics.EventLog:ModifyOverflowPolicy
(System.Diagnostics.OverflowAction,int)
at CsObexFtp.ClasseADebugger.InitializeEventLogTraceListener () [0x00000]
at CsObexFtp.ClasseADebugger..ctor () [0x00000]
at CsObexFtp.MainForm..ctor () [0x00000]
at (wrapper remoting-invoke-with-check) CsObexFtp.MainForm:.ctor ()
at CsObexFtp.MainForm.Main (System.String[] args) [0x00000]
Classe to reproduce it :
using System;
using System.IO;
using System.Windows.Forms;
using System.Diagnostics;
using System.Reflection;
namespace CsObexFtp
{
public class ClasseADebugger
{
public ClasseADebugger()
{
string DebugFile = Assembly.GetExecutingAssembly().Location + ".log";
if(File.Exists(DebugFile)==true)File.Delete(DebugFile);
//Création d'un "listener" texte pour sortie dans un fichier texte
Debug.Listeners.Add(new TextWriterTraceListener(DebugFile));
Debug.Listeners.Add(InitializeEventLogTraceListener());
Debug.AutoFlush = true; //On écrit directement, pas de
temporisation.
//Only when compiled with debug Flag
Debug.WriteLine(DateTime.Now + ": " + "Constructeur " +
this.ToString());
//normaly all the time but strange there is a TRACE flag in project
property
//Trace.WriteLine("Constructeur " + this.ToString());
}
private static EventLogTraceListener InitializeEventLogTraceListener()
{
//System.Diagnostics.EventLog.Delete("Cs-ObexFtp");
//System.Diagnostics.EventLog.DeleteEventSource("Cs-ObexFtp");
// Create the source, if it does not already exist.
if (!System.Diagnostics.EventLog.SourceExists("Cs-ObexFtp-Log"))
{
System.Diagnostics.EventLog.CreateEventSource("Cs-ObexFtp-Log",
"Cs-ObexFtp-Log");
}
EventLogTraceListener eventLog = new
EventLogTraceListener("Cs-ObexFtp-Log");
eventLog.Name = "Cs-ObexFtp-Log";
eventLog.TraceOutputOptions = TraceOptions.Callstack &
TraceOptions.DateTime & TraceOptions.LogicalOperationStack &
TraceOptions.ProcessId & TraceOptions.ThreadId & TraceOptions.Timestamp;
EventLog inputLog = new EventLog("Cs-ObexFtp-Log");
inputLog.ModifyOverflowPolicy(OverflowAction.OverwriteAsNeeded,
1);//Not work with linux
inputLog.MaximumKilobytes = 1024 * 15;
return eventLog;
}
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list