Class EventLogProvider
Provides basic operations with the event log.
[ProviderInterface(typeof(IEventLogInfoProvider))]
public class EventLogProvider : AbstractInfoProvider<EventLogInfo, EventLogProvider>, IInfoProvider, ICustomizableProvider, IBulkOperationProvider, IWebFarmProvider, IInfoValidator<EventLogInfo>, IInfoByGuidProvider<EventLogInfo>, IInfoByNameProvider<EventLogInfo>, IBulkInfoProvider<EventLogInfo>, IEventLogInfoProvider, IInfoProvider<EventLogInfo>, IInfoByIdProvider<EventLogInfo>
- Inheritance
-
objectEventLogProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
EventLogProvider()
Initializes a new instance of the EventLogProvider class.
public EventLogProvider()
Properties
Errors
Counter of errors.
[Obsolete("Property was not intended for public use and will be removed in the next version.")]
public static IPerformanceCounter Errors { get; }
Property Value
LogDocumentFieldChanges
Indicates if log should contain the changes to particular document document fields.
public static bool LogDocumentFieldChanges { get; set; }
Property Value
- bool
LogFieldChanges
Indicates if log should contain the changes to particular fields.
[Obsolete("The LogFieldChanges property is obsolete. Setting or reading this property will have no effect on the system behavior.")]
public static bool LogFieldChanges { get; set; }
Property Value
- bool
LoggingEnabled
Indicates if logging is enabled.
public static bool LoggingEnabled { get; set; }
Property Value
- bool
Warnings
Counter of warnings.
[Obsolete("Property was not intended for public use and will be removed in the next version.")]
public static IPerformanceCounter Warnings { get; }
Property Value
Methods
CanLogEvent(EventLogInfo, bool)
Returns true if the event can be logged
protected virtual bool CanLogEvent(EventLogInfo eventObject, bool logDirectly)
Parameters
eventObjectEventLogInfoEvent object
logDirectlyboolWhether the event is being logged directly (meaning not using the thread worker).
Returns
- bool
CannotLogEventInternal(Exception)
Executes when the event logging throws an error.
protected virtual void CannotLogEventInternal(Exception ex)
Parameters
exExceptionException thrown upon problem with logging
ClearHashtables(bool)
Clears up hashtables of EventLogProvider.
protected override void ClearHashtables(bool logTasks)
Parameters
logTasksboolIf true, web farm tasks are logged
GetEventLogText(EventLogInfo)
Creates string representation of event log object.
public static string GetEventLogText(EventLogInfo eventLogInfo)
Parameters
eventLogInfoEventLogInfoEventLogInfo object
Returns
- string
GetEventLogTextInternal(EventLogInfo)
Creates string representation of event log object.
protected virtual string GetEventLogTextInternal(EventLogInfo eventLogInfo)
Parameters
eventLogInfoEventLogInfoEventLogInfo object
Returns
- string
GetExceptionLogMessage(Exception)
Gets complete log for exception with message and deep stack trace.
public static string GetExceptionLogMessage(Exception ex)
Parameters
exExceptionException to log
Returns
- string
GetExceptionLogMessageInternal(Exception)
Gets complete log for exception with message and deep stack trace.
protected virtual string GetExceptionLogMessageInternal(Exception ex)
Parameters
exExceptionException to log
Returns
- string
GetLogItems()
Gets the log items count.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
public static int GetLogItems()
Returns
- int
GetLogItemsInternal()
Returns the log items count.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
protected virtual int GetLogItemsInternal()
Returns
- int
Remarks
This method get item count straight from database without any caching.
GetLogSize()
Gets the log size.
public static int GetLogSize()
Returns
- int
GetLogSizeInternal()
Gets the log size.
protected virtual int GetLogSizeInternal()
Returns
- int
LogEvent(EventLogInfo)
Writes a new record to the event log.
public static EventLogInfo LogEvent(EventLogInfo eventObject)
Parameters
eventObjectEventLogInfoEvent object.
Returns
LogEventInternal(EventLogInfo)
Writes a new record to the event log.
protected virtual EventLogInfo LogEventInternal(EventLogInfo eventObject)
Parameters
eventObjectEventLogInfoContains event
Returns
LogEventInternal(EventLogInfo, bool)
Writes a new record to the event log.
protected virtual EventLogInfo LogEventInternal(EventLogInfo eventObject, bool logDirectly)
Parameters
eventObjectEventLogInfoContains event
logDirectlyboolIf true, the event is logged directly to the database. Otherwise, the event is logged to the queue processed by background worker to optimize performance.
Returns
LogEventInternal(string, string, string, string, string, int, string, string, string, string, string, DateTime?, LoggingPolicy)
Writes a new record to the event log.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
protected virtual EventLogInfo LogEventInternal(string eventType, string source, string eventCode, string eventDescription, string eventUrl, int userId, string userName, string ipAddress, string machineName, string urlReferrer, string userAgent, DateTime? eventTime, LoggingPolicy loggingPolicy)
Parameters
eventTypestringType of the event. Please use predefined constants from EventLogProvider
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (UPDATEDOC, SENDEMAIL, DELETE, etc.)
eventDescriptionstringDetailed description of the event
eventUrlstringEvent URL address
userIdintID of the user, who caused logged event
userNamestringName of the user, who caused logged event
ipAddressstringIP Address of the user, who caused logged event
machineNamestringName of machine
urlReferrerstringReferrer URL
userAgentstringUser agent
eventTimeDateTime?Date and time when the event occurs
loggingPolicyLoggingPolicyLogging policy.
Returns
LogExceptionInternal(string, string, Exception, string, LoggingPolicy)
Writes a new error to the event log.
[Obsolete("Method was not intended for public use and will be removed in the next version.")]
protected virtual void LogExceptionInternal(string source, string eventCode, Exception ex, string additionalMessage, LoggingPolicy loggingPolicy)
Parameters
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (UPDATEDOC, SENDEMAIL, DELETE, etc.)
exExceptionException to be logged
additionalMessagestringAdditional information to the exception message
loggingPolicyLoggingPolicyLogging policy.
LogMetadata()
Returns true if the metadata should be logged.
public static bool LogMetadata()
Returns
- bool
Set(EventLogInfo)
Inserts or updates the info object in the underlying data store.
public override void Set(EventLogInfo info)
Parameters
infoEventLogInfoInfo object to be inserted or updated.
Exceptions
- ArgumentNullException
Thrown when
infois null.