/// <summary> /// Report the <see cref="IExceptionHandlingInstrumentationProvider.FireExceptionHandlingErrorOccurred"/> to instrumentation. /// </summary> /// <param name="errorMessage">Message describing the error.</param> public void FireExceptionHandlingErrorOccurred(string errorMessage) { if (EventLoggingEnabled) { string message = string.Format( CultureInfo.CurrentCulture, Resources.ErrorHandlingExceptionMessage, instanceName); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(message, errorMessage); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } }
public void CyptographicOperationFailed(object sender, CrytographicOperationErrorEventArgs e) { if (EventLoggingEnabled) { string errorMessage = string.Format( Resources.Culture, Resources.ErrorCryptographicOperationFailed, instanceName); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(errorMessage, e.Exception, e.Message); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } if (WmiEnabled) FireManagementInstrumentation(new SymmetricOperationFailedEvent(instanceName, e.Message, e.Exception.ToString())); }
/// <summary> /// </summary> /// <param name="message">The message that describes the failure.</param> /// <param name="exception">The exception thrown during the failure.</param> public void FireCyptographicOperationFailed(string message, Exception exception) { if (exception == null) throw new ArgumentNullException("exception"); if (EventLoggingEnabled) { string errorMessage = string.Format( CultureInfo.CurrentCulture, Resources.ErrorCryptographicOperationFailed, instanceName); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(errorMessage, exception, message); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Default handler for the <see cref="NewDataInstrumentationProvider.FireConnectionFailedEvent"/> event. /// </summary> /// <remarks> /// Increments the "Connections Failed/sec" performance counter and writes /// an error entry to the event log. /// </remarks> /// <param name="connectionString">The connection string that caused the failed connection, with credentials removed.</param> /// <param name="exception">The exception thrown when the connection failed.</param> public void FireConnectionFailedEvent(string connectionString, Exception exception) { if (exception == null) throw new ArgumentNullException("exception"); if (PerformanceCountersEnabled) { connectionFailedCounter.Increment(); totalConnectionFailedCounter.Increment(); } if (EventLoggingEnabled) { string errorMessage = string.Format( CultureInfo.CurrentCulture, Resources.ErrorConnectionFailedMessage, instanceName); string extraInformation = string.Format( CultureInfo.CurrentCulture, Resources.ErrorConnectionFailedExtraInformation, connectionString); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(errorMessage, exception, extraInformation); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } }
public void ConnectionFailed(object sender, ConnectionFailedEventArgs e) { if (PerformanceCountersEnabled) connectionFailedCounter.Increment(); if (WmiEnabled) FireManagementInstrumentation(new ConnectionFailedEvent(instanceName, e.ConnectionString, e.Exception.ToString())); if (EventLoggingEnabled) { string errorMessage = string.Format( Resources.Culture, Resources.ErrorConnectionFailedMessage, instanceName); string extraInformation = string.Format( Resources.Culture, Resources.ErrorConnectionFailedExtraInformation, e.ConnectionString); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(errorMessage, e.Exception, extraInformation); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } }
public void ExceptionHandlingErrorOccurred(object sender, ExceptionHandlingErrorEventArgs e) { if (EventLoggingEnabled) { string errorMessage = string.Format( Resources.Culture, Resources.ErrorHandlingExceptionMessage, instanceName); string entryText = new EventLogEntryFormatter(Resources.BlockName).GetEntryText(errorMessage, e.Message); EventLog.WriteEntry(GetEventSourceName(), entryText, EventLogEntryType.Error); } if (WmiEnabled) ManagementInstrumentation.Fire(new ExceptionHandlingFailureEvent(instanceName, e.Message)); }