From 38fc89dac6dd74fb9da9ee8cf0e23337ee263900 Mon Sep 17 00:00:00 2001 From: "Infineon\\StieberD" Date: Wed, 4 Jun 2025 11:05:09 -0700 Subject: [PATCH] Updated service manager debugger intercept to also send notes (emails). Refactored Service_Manager_Events so that the call stack is not hidden behind MCP. updated debugger intercept distribution group --- .../SERVICE_MANAGER_DEBUGGER_INTERCEPT.txt | 69 ++++++++++++++----- LSL2/STPROC/SERVICE_MANAGER_EVENTS.txt | 5 +- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/LSL2/STPROC/SERVICE_MANAGER_DEBUGGER_INTERCEPT.txt b/LSL2/STPROC/SERVICE_MANAGER_DEBUGGER_INTERCEPT.txt index 1d2850b..d53787a 100644 --- a/LSL2/STPROC/SERVICE_MANAGER_DEBUGGER_INTERCEPT.txt +++ b/LSL2/STPROC/SERVICE_MANAGER_DEBUGGER_INTERCEPT.txt @@ -16,7 +16,8 @@ Subroutine Service_Manager_Debugger_Intercept(Void) Metadata : History : (Date, Initials, Notes) - 07/25/23 djs Original programmer. + 07/25/23 djs Original programmer. + 06/04/25 djs Added LSL note creation (and email forwarding) to notify OI_ADMIN users when invoked. ***********************************************************************************************************************/ @@ -24,24 +25,58 @@ Subroutine Service_Manager_Debugger_Intercept(Void) $insert APP_INSERTS $insert RTI_DEBUG_COMMON +$insert ENVIRON_CONSTANTS -Declare function Environment_Services, Logging_Services -Declare subroutine Logging_Services +Declare function Environment_Services, Logging_Services, Environment_Services, GetCommandLine, Datetime +Declare subroutine Logging_Services, obj_Notes, Set_Env -LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager' -LogDate = Oconv(Date(), 'D4/') -LogTime = Oconv(Time(), 'MTS') -LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' OEngine Log.csv' -Headers = 'Stored Proc Status' : @FM : 'Stored Proc Status Code' : @FM : 'Current Program' : @FM : 'Call Depth' : @FM : 'Line No' : @FM : 'Call Stack' -objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$) -LogData = '' -LogData<1> = SPStatus@ -LogData<2> = SPStatCode@ -LogData<3> = Curr_Program@ -LogData<4> = CallDepth@ -LogData<5> = LineNo@ -LogData<6> = CallStack@ -Logging_Services('AppendLog', objLog, LogData, @RM, @FM, '', '', '') +Main: + + // Log event in .\LogFiles\ServiceManager\ OEngine Log.csv + LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager' + LogDate = Oconv(Date(), 'D4/') + LogTime = Oconv(Time(), 'MTS') + LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' OEngine Log.csv' + Headers = 'Stored Proc Status' : @FM : 'Stored Proc Status Code' : @FM : 'Current Program' : @FM + Headers := 'Call Depth' : @FM : 'Line No' : @FM : 'Call Stack' + objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$) + LogData = '' + LogData<1> = spStatus@ + LogData<2> = spStatCode@ + LogData<3> = curr_Program@ + LogData<4> = callDepth@ + LogData<5> = lineNo@ + LogData<6> = callStack@ + Logging_Services('AppendLog', objLog, LogData, @RM, @FM, '', '', '') + + // Send an LSL message to FI admins to alert them. This is forward to their email address if configured in + // their LSL_USERS record. + CmdLine = GetCommandLine() + EngIndex = Index(CmdLine, '/S=', 1) + EngNo = CmdLine[EngIndex + 3, 'F '] + Server = Environment_Services('GetServer') + Recipients = '' + SentFrom = 'SYSTEM' + Subject = 'Service Manager Debugger Intercept Invoked' + Message = OConv(Datetime(), 'DT2/^H') + Message<2> = 'RevEngineHost (OEngine) ':EngNo:' encountered a runtime error on server ':Server + Message<3> = 'Stored Procedure Status: ':spStatus@ + StatCodes = spStatCode@ + Swap Char(0) with ',' in StatCodes + Swap Char(23) with '' in StatCodes + Message<4> = 'Stored Procedure Status Code: ':StatCodes + Message<5> = 'Current Program: ':curr_Program@ + Message<6> = 'Call Depth: ':callDepth@ + Message<7> = 'Line No: ':lineNo@ + Message<8> = 'Call Stack: ':\0D0A\:callStack@ + Swap @FM with \0D0A\ in Message + Swap @VM with ',' in Message + AttachWindow = '' + AttachKey = '' + SendToGroup = 'OI_SYSADMIN' + + Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup + obj_Notes('Create',Parms) Return diff --git a/LSL2/STPROC/SERVICE_MANAGER_EVENTS.txt b/LSL2/STPROC/SERVICE_MANAGER_EVENTS.txt index 9241002..da7dcba 100644 --- a/LSL2/STPROC/SERVICE_MANAGER_EVENTS.txt +++ b/LSL2/STPROC/SERVICE_MANAGER_EVENTS.txt @@ -108,8 +108,7 @@ Event WINDOW.TIMER() Procedures = ServiceDetail Arguments = ServiceDetail For Each Procedure in Procedures using @VM setting procPos - If Procedure[-9, 9] _EQC '_SERVICES' then Procedure[-9, 9] = '' - Command = 'RUN MCP ' : Quote(Procedure) + Command = 'RUN ' : Procedure Arguments = Arguments<0, procPos> If Arguments NE '' then For Each Argument in Arguments using ',' @@ -130,7 +129,7 @@ Event WINDOW.TIMER() If Not(Num(Modifier)) then Modifier = '' Argument = Date() + Modifier end - Command := ', ' : Quote(Argument) + Command := ' ' : Quote(Argument) Next Argument end Next Procedure