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
This commit is contained in:
Infineon\StieberD 2025-06-04 11:05:09 -07:00
parent 614da8ad3b
commit 38fc89dac6
2 changed files with 54 additions and 20 deletions

View File

@ -17,6 +17,7 @@ Subroutine Service_Manager_Debugger_Intercept(Void)
History : (Date, Initials, Notes) 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 APP_INSERTS
$insert RTI_DEBUG_COMMON $insert RTI_DEBUG_COMMON
$insert ENVIRON_CONSTANTS
Declare function Environment_Services, Logging_Services Declare function Environment_Services, Logging_Services, Environment_Services, GetCommandLine, Datetime
Declare subroutine Logging_Services Declare subroutine Logging_Services, obj_Notes, Set_Env
Main:
// Log event in .\LogFiles\ServiceManager\<Date> OEngine Log.csv
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager' LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager'
LogDate = Oconv(Date(), 'D4/') LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS') LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' OEngine Log.csv' 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' 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$) objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LogData = '' LogData = ''
LogData<1> = SPStatus@ LogData<1> = spStatus@
LogData<2> = SPStatCode@ LogData<2> = spStatCode@
LogData<3> = Curr_Program@ LogData<3> = curr_Program@
LogData<4> = CallDepth@ LogData<4> = callDepth@
LogData<5> = LineNo@ LogData<5> = lineNo@
LogData<6> = CallStack@ LogData<6> = callStack@
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, '', '', '') 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 Return

View File

@ -108,8 +108,7 @@ Event WINDOW.TIMER()
Procedures = ServiceDetail<SERVICES.PROCEDURES$> Procedures = ServiceDetail<SERVICES.PROCEDURES$>
Arguments = ServiceDetail<SERVICES.ARGUMENTS$> Arguments = ServiceDetail<SERVICES.ARGUMENTS$>
For Each Procedure in Procedures using @VM setting procPos For Each Procedure in Procedures using @VM setting procPos
If Procedure[-9, 9] _EQC '_SERVICES' then Procedure[-9, 9] = '' Command = 'RUN ' : Procedure
Command = 'RUN MCP ' : Quote(Procedure)
Arguments = Arguments<0, procPos> Arguments = Arguments<0, procPos>
If Arguments NE '' then If Arguments NE '' then
For Each Argument in Arguments using ',' For Each Argument in Arguments using ','
@ -130,7 +129,7 @@ Event WINDOW.TIMER()
If Not(Num(Modifier)) then Modifier = '' If Not(Num(Modifier)) then Modifier = ''
Argument = Date() + Modifier Argument = Date() + Modifier
end end
Command := ', ' : Quote(Argument) Command := ' ' : Quote(Argument)
Next Argument Next Argument
end end
Next Procedure Next Procedure