Ejemplo n.º 1
0
 static EventLog()
 {
     if (!DiagELog.SourceExists("ServUO"))
     {
         DiagELog.CreateEventSource("ServUO", "Application");
     }
 }
Ejemplo n.º 2
0
 static EventLog()
 {
     if (!DiagELog.SourceExists("16Below"))
     {
         DiagELog.CreateEventSource("16Below", "Application");
     }
 }
Ejemplo n.º 3
0
 static EventLog()
 {
     if (!DiagELog.SourceExists("Project1501"))
     {
         DiagELog.CreateEventSource("Project1501", "Application");
     }
 }
Ejemplo n.º 4
0
 static EventLog()
 {
     if (!DiagELog.SourceExists(SystemName))
     {
         DiagELog.CreateEventSource(SystemName, "Application");
     }
 }
Ejemplo n.º 5
0
        public void WriteEntry(LogEntry entry)
        {
            if (!WindowsEventLog.SourceExists(Source))
            {
                WindowsEventLog.CreateEventSource(Source, log);
            }
            switch (entry.Severity)
            {
            case Severity.Disaster:
                _eventLog.WriteEntry(entry.Message, EventLogEntryType.Error);
                break;

            case Severity.Warning:
                _eventLog.WriteEntry(entry.Message, EventLogEntryType.Warning);
                break;

            case Severity.Information:
                _eventLog.WriteEntry(entry.Message, EventLogEntryType.Information);
                break;
            }
        }
        /// <include file='doc\EventLogInstaller.uex' path='docs/doc[@for="EventLogInstaller.Rollback"]/*' />
        /// <devdoc>
        /// Called when this or another component in the installation has failed.
        /// </devdoc>
        public override void Rollback(IDictionary savedState)
        {
            base.Rollback(savedState);

            Context.LogMessage(Res.GetString(Res.RestoringEventLog, Source));

            if (savedState["baseInstalledAndPlatformOK"] != null)
            {
                bool logExists = (bool)savedState["logExists"];
                if (!logExists)
                {
                    EventLog.Delete(Log, ".");
                }
                else
                {
                    bool   alreadyRegistered;
                    object alreadyRegisteredObj = savedState["alreadyRegistered"];
                    if (alreadyRegisteredObj == null)
                    {
                        alreadyRegistered = false;
                    }
                    else
                    {
                        alreadyRegistered = (bool)alreadyRegisteredObj;
                    }

                    if (!alreadyRegistered)
                    {
                        // delete the source we installed, assuming it succeeded. Then put back whatever used to be there.
                        if (EventLog.SourceExists(Source, "."))
                        {
                            EventLog.DeleteEventSource(Source, ".");
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        static Logger()
        {
            try {
                Pid = (short)Process.GetCurrentProcess().Id;
                Errors = true;
            #if DEBUG
                // by default, we'll turn warnings on only in a debug version.
                Warnings = true;
            #else
            // Warnings = false;
                Warnings = true; // let's just put this on until we get into RC.
            #endif
                Messages = true;

                Source = (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly()).Title();
                Source = Source.Trim('\0');

                if (String.IsNullOrEmpty(Source)) {
                    Source = "CoApp (misc)";
                }

                if (!EventLog.SourceExists(Source)) {
                    EventLog.CreateEventSource(Source, "CoApp");
                }
                EventLog = new EventLog("CoApp", ".", Source);

                Task.Factory.StartNew(() => {
                    while (!EventLog.SourceExists(Source)) {
                        Thread.Sleep(20);
                    }
                    _ready = true;
                });
            } catch {
                _ready = true;
            }
        }