added additional logging to try and capture the root cause of email service critical mona alerts

This commit is contained in:
Infineon\StieberD
2025-03-18 14:34:03 -07:00
committed by Stieber Daniel (CSC FI SPS MESLEO)
parent d5514bc3ca
commit 3d1f096f80
2 changed files with 25 additions and 15 deletions

View File

@ -35,7 +35,7 @@ LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\EmailService'
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' EmailService.csv'
Headers = 'Logging DTM' : @FM : 'Error'
Headers = 'Logging DTM' : @FM : 'LogData'
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
ErrTitle = 'Error in Stored Procedure "obj_Notes"'
@ -358,16 +358,15 @@ ForwardEMail:
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
ServiceKeyID = 'Obj_Notes*ForwardEMail'
Lock hSysLists, ServiceKeyID then
rv = Set_Status(0)
rv = Set_Status(0)
RList('SELECT EMAIL_BOX BY NOTE_KEY', 5, '', '', '')
Done = 0
Done = False$
LOOP
ReadNext eMailBoxKey else Done = 1
ReadNext eMailBoxKey else Done = True$
UNTIL Done
mbParms = 'EMAIL_BOX':@RM:eMailBoxKey
eMailBoxRec = obj_Tables('ReadRec',mbParms)
If @File_Error EQ '' then
eMailAddr = eMailBoxRec<EMAIL_BOX_EMAIL_ADDR$>
eMailText = eMailBoxRec<EMAIL_BOX_EMAIL_TEXT$>
eMailHeader = eMailBoxRec<EMAIL_BOX_EMAIL_HEADER$>
@ -377,11 +376,15 @@ ForwardEMail:
IF OISentFrom = 'OI_ERROR' THEN SendTo := XLATE('SEC_GROUPS', 'OI_ADMIN', 'USER', 'X')
Success = Email_Services('SendEmail', SentFrom, SendTo, eMailHeader, eMailText)
If Success then
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = 'Successfully sent email From: ':SentFrom:' To: ':SendTo:' Header: ':eMailHeader:' Body: ':eMailText
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'ok')
end else
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = Error_Services('GetMessage')
LogData<2> = 'Failed to send email From: ':SentFrom:' To: ':SendTo:' Header: ':eMailHeader:' Body: ':eMailText:' Error message: ':Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Mona_Services('SendBufferedStatus', 'OPENINSIGHT_MES_OP_FE', 'Email-Service', 'critical')
end
@ -643,4 +646,3 @@ BulkCreate:
RETURN