Example #1
0
        /// <summary>
        /// Append the log entry to the configured text file.
        /// </summary>
        /// <param name="logEntry"><see cref="LogEntry"></see> to be appended to logging file</param>
        protected override void SendMessageCore(LogEntry logEntry)
        {
            if (ValidateParameters(logEntry))
            {
                try
                {
                   webservice.Logging ws = new webservice.Logging();
                   ws.Url = this.wsSinkData.Url;

                   webservice.WSLogEntry wsLogEntry = new webservice.WSLogEntry();
                   wsLogEntry.Message = logEntry.Message;
                   wsLogEntry.Priority = logEntry.Priority;
                   wsLogEntry.Category = logEntry.Category;
                   wsLogEntry.EventId = logEntry.EventId;
                   wsLogEntry.Severity = (webservice.Severity)Enum.Parse(typeof(webservice.Severity), logEntry.Severity.ToString());
                   wsLogEntry.Title = logEntry.Title;
                   wsLogEntry.ExtendedProperties = WSLogEntry.ToJaggedArray((Hashtable)logEntry.ExtendedProperties);

                   ws.Log(wsLogEntry);

                }
                catch (Exception e)
                {
                    logEntry.AddErrorMessage(SR.SinkFailure(e.ToString()));
                    throw;
                }
                catch
                {
                    logEntry.AddErrorMessage(SR.SinkFailure(SR.UnknownError));
                }
            }
        }
Example #2
0
        /// <summary>
        /// Append the log entry to the configured text file.
        /// </summary>
        /// <param name="logEntry"><see cref="LogEntry"></see> to be appended to logging file</param>
        protected override void SendMessageCore(LogEntry logEntry)
        {
            if (ValidateParameters(logEntry))
            {
                try
                {
                    webservice.Logging ws = new webservice.Logging();
                    ws.Url = this.wsSinkData.Url;

                    webservice.WSLogEntry wsLogEntry = new webservice.WSLogEntry();
                    wsLogEntry.Message            = logEntry.Message;
                    wsLogEntry.Priority           = logEntry.Priority;
                    wsLogEntry.Category           = logEntry.Category;
                    wsLogEntry.EventId            = logEntry.EventId;
                    wsLogEntry.Severity           = (webservice.Severity)Enum.Parse(typeof(webservice.Severity), logEntry.Severity.ToString());
                    wsLogEntry.Title              = logEntry.Title;
                    wsLogEntry.ExtendedProperties = WSLogEntry.ToJaggedArray((Hashtable)logEntry.ExtendedProperties);

                    ws.Log(wsLogEntry);
                }
                catch (Exception e)
                {
                    logEntry.AddErrorMessage(SR.SinkFailure(e.ToString()));
                    throw;
                }
                catch
                {
                    logEntry.AddErrorMessage(SR.SinkFailure(SR.UnknownError));
                }
            }
        }