Waiting for a patch, I altered this sp:
ALTER PROCEDURE dbo.AddEventLog @LogGUID varchar(36), @LogTypeKey nvarchar(35), @LogUserID int, @LogUserName nvarchar(50), @LogPortalID int, @LogPortalName nvarchar(100), @LogCreateDate datetime, @LogServerName nvarchar(50), @LogProperties ntext, @LogConfigID int AS
IF @LogProperties not like '%Core Localization File Not Found%' BEGIN
INSERT INTO dbo.EventLog (LogGUID, LogTypeKey, LogUserID, LogUserName, LogPortalID, LogPortalName, LogCreateDate, LogServerName, LogProperties, LogConfigID) VALUES (@LogGUID, @LogTypeKey, @LogUserID, @LogUserName, @LogPortalID, @LogPortalName, @LogCreateDate, @LogServerName, @LogProperties, @LogConfigID) DECLARE @NotificationActive bit DECLARE @NotificationThreshold bit DECLARE @ThresholdQueue int DECLARE @NotificationThresholdTime int DECLARE @NotificationThresholdTimeType int DECLARE @MinDateTime smalldatetime DECLARE @CurrentDateTime smalldatetime SET @CurrentDateTime = getDate() SELECT TOP 1 @NotificationActive = EmailNotificationIsActive, @NotificationThreshold = NotificationThreshold, @NotificationThresholdTime = NotificationThresholdTime, @NotificationThresholdTimeType = @NotificationThresholdTimeType, @MinDateTime = CASE --seconds WHEN NotificationThresholdTimeType=1 THEN DateAdd(second, NotificationThresholdTime * -1, @CurrentDateTime) --minutes WHEN NotificationThresholdTimeType=2 THEN DateAdd(minute, NotificationThresholdTime * -1, @CurrentDateTime) --hours WHEN NotificationThresholdTimeType=3 THEN DateAdd(Hour, NotificationThresholdTime * -1, @CurrentDateTime) --days WHEN NotificationThresholdTimeType=4 THEN DateAdd(Day, NotificationThresholdTime * -1, @CurrentDateTime) END FROM dbo.EventLogConfig WHERE ID = @LogConfigID IF @NotificationActive=1 BEGIN SELECT @ThresholdQueue = COUNT(*) FROM dbo.EventLog INNER JOIN dbo.EventLogConfig ON dbo.EventLog.LogConfigID = dbo.EventLogConfig.ID WHERE LogCreateDate > @MinDateTime PRINT 'MinDateTime=' + convert(varchar(20), @MinDateTime) PRINT 'ThresholdQueue=' + convert(varchar(20), @ThresholdQueue) PRINT 'NotificationThreshold=' + convert(varchar(20), @NotificationThreshold) IF @ThresholdQueue > @NotificationThreshold BEGIN UPDATE dbo.EventLog SET LogNotificationPending = 1 WHERE LogConfigID = @LogConfigID AND LogNotificationPending IS NULL AND LogCreateDate > @MinDateTime END END END GO
|