Example #1
0
 public OperatorMessage(OperatorMessageType type)
 {
     _messageType = type;
 }
Example #2
0
        /// ****************************************************************
        ///   public WriteEventLog [static]
        /// ----------------------------------------------------------------
        ///   <summary>
        ///     Writes a message to the event log.
        ///   </summary>
        /// ----------------------------------------------------------------
        ///   <param name="severity">
        ///     The severity type.
        ///   </param>
        ///
        ///   <param name="category">
        ///     The category type.
        ///   </param>
        ///
        ///   <param name="messageId">
        ///	    The message type.
        ///   </param>
        ///
        ///   <param name="message">
        ///     The message.
        ///   </param>
        /// ****************************************************************
        ///
        public static void WriteEventLog(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message)
        {
            readWriteLock.AcquireReaderLock(Constants.ReadLockTimeout);

            try
            {
                //
                // Map the severity type to an event log entry type.
                //
                System.Diagnostics.EventLogEntryType entryType;

                switch (severity)
                {
                case SeverityType.Error:
                    entryType = System.Diagnostics.EventLogEntryType.Error;
                    break;

                case SeverityType.Warning:
                    entryType = System.Diagnostics.EventLogEntryType.Warning;
                    break;

                case SeverityType.PassAudit:
                    entryType = System.Diagnostics.EventLogEntryType.SuccessAudit;
                    break;

                case SeverityType.FailAudit:
                    entryType = System.Diagnostics.EventLogEntryType.FailureAudit;
                    break;

                default:
                    //
                    // SeverityType.Info and Verbose are mapped to info
                    //
                    entryType = System.Diagnostics.EventLogEntryType.Information;
                    break;
                }

                System.Diagnostics.EventLog.WriteEntry(
                    "UDDIRuntime",
                    message,
                    entryType,
                    (int)messageId,
                    (short)category);
            }
            catch (Exception e)
            {
                WriteDebugger(
                    SeverityType.Error,
                    CategoryType.None,
                    "Could not write to event log.\r\n\r\nDetails:\r\n" + e.ToString());
            }
            finally
            {
                readWriteLock.ReleaseReaderLock();
            }
        }
Example #3
0
        //
        // Note: All calls to this function should occur in administrator initiated
        // processes. No calls to this function should as a result of an HTTP request from
        // a SOAP API.
        // This is verified to be true on 3/1/2002 by creeves
        //
        public static void OperatorMail(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message)
        {
            string mailTo = Config.GetString("Debug.MailTo", null);

            if (null == mailTo)
            {
                Debug.Write(
                    SeverityType.Info,
                    CategoryType.Config,
                    "Skipping send of operator mail.  Configuration setting 'Debug.MailTo' not set.");

                return;
            }

            Debug.VerifySetting("Debug.MailFrom");

            try
            {
                string mailCc      = Config.GetString("Debug.MailCc", null);
                string mailSubject = Config.GetString(
                    "Debug.MailSubject",
                    "Operator message from {0}.  Severity: {1}, Category: {2}");

                MailMessage mail = new MailMessage();

                mail.To      = mailTo;
                mail.From    = Config.GetString("Debug.MailFrom");
                mail.Subject = String.Format(
                    mailSubject,
                    System.Environment.MachineName,
                    severity.ToString(),
                    category.ToString(),
                    (int)messageId);

                if (null != mailCc)
                {
                    mail.Cc = mailCc;
                }

                mail.BodyFormat = MailFormat.Text;
                mail.Body       =
                    "SEVERITY: " + severity.ToString() + "\r\n" +
                    "CATEGORY: " + category.ToString() + "\r\n" +
                    "EVENT ID: " + (int)messageId + "\r\n\r\n" +
                    message;

                SmtpMail.Send(mail);
            }
            catch (Exception e)
            {
                Debug.OperatorMessage(
                    SeverityType.Error,
                    CategoryType.None,
                    OperatorMessageType.CouldNotSendMail,
                    "Could not send operator mail.\r\n\r\nDetails:\r\n\r\n" + e.ToString());
            }
        }
Example #4
0
        /// ****************************************************************
        ///   public OperatorMessage [static]
        /// ----------------------------------------------------------------
        ///   <summary>
        ///		Writes an operator message to the event log.
        ///   </summary>
        /// ----------------------------------------------------------------
        ///   <param name="severity">
        ///     The severity of the message.
        ///   </param>
        ///
        ///   <param name="category">
        ///     The category of the message.
        ///   </param>
        ///
        ///   <param name="messageId">
        ///		Operator message type.
        ///   </param>
        ///
        ///   <param name="message">
        ///     Message to write to the event log.
        ///   </param>
        /// ****************************************************************
        ///
        public static void OperatorMessage(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message)
        {
            try
            {
                //
                // Store the entry in the event log as an error.
                //
                WriteEventLog(
                    severity,
                    category,
                    messageId,
                    message);

                //
                // Also write this as a warning level message to any debug message
                // listeners (other than event log, since we already logged this
                // message there).
                //
                if ((int)severity <= debuggerLevel.GetInt())
                {
                    WriteDebugger(
                        severity,
                        category,
                        "Operator message [" + messageId.ToString() + "]: " + message);
                }

                if ((int)severity <= fileLogLevel.GetInt())
                {
                    WriteFileLog(
                        severity,
                        category,
                        "Operator message [" + messageId.ToString() + "]: " + message);
                }
            }
            catch (Exception)
            {
            }
        }