Michael_Lowry

Script to enable/disable AE tracing for quick collection of traces

Discussion created by Michael_Lowry on Jul 22, 2015
Latest reply on Jan 25, 2018 by Michael_Lowry

I developed a script to  quickly enable/disable tracing for the whole AE. Details follow.

 

Create an SEC_SQLI VARA object called UC4.AE_PROCCESSES_SHORT.VARA_SEC_SQLI, with the following query:

select substr(OH_Name,instr(OH_Name,'#') + 1) as Process_Name
from OH
where OH_OType = 'SERV';

Next, create a SCRI object called UC4.TRACE.SYSTEM_WIDE.SCRI with the following process content:

:SET &MyWPTraceFlags# = "0000000000000000"
:SET &MyCPTraceFlags# = "0000000000000000"
! :SET &MyWPTraceFlags# = "2400000000000000"
! :SET &MyCPTraceFlags# = "9000000000000000"
:SET &ChangeLogging# = "YES"
:PRINT "System name: &$SYSTEM#"
:P
! For work processes, trace options are set for the whole system (all WPs).
:PRINT "Setting trace options of all WPs."
:SET &MyTraceFlags# = &MyWPTraceFlags#
:SET_UC_SETTING SET_TRACE, &$SYSTEM#, &MyTraceFlags#
:P
:SET &MyVara# = "UC4.AE_PROCCESSES_SHORT.VARA_SEC_SQLI"
:SET &HND# = PREP_PROCESS_VAR(&MyVara#)
:PROCESS &HND#
: SET &ProcessName# = GET_PROCESS_LINE(&HND#,1)
: PRINT "Process name: &ProcessName#"
: SET &FullProcessName# = &$SYSTEM##&ProcessName#
: SET &ProccessStatus# = SYS_SERVER_ALIVE("&FullProcessName#")
: IF &ProccessStatus# = "Y"
: PRINT "Process &FullProcessName# is active."
! For communication processes, trace options must be set on a per-process basis
: IF STR_CUT(&ProcessName#,1,1) = "C"
: SET &MyTraceFlags# = &MyCPTraceFlags#
: PRINT "Setting trace options of &ProcessName# to &MyTraceFlags#"
: SET_UC_SETTING SET_TRACE, &FullProcessName#, &MyTraceFlags#
: ENDIF
: IF &ChangeLogging# = "YES"
! For all processes (WPs & CPs), initiate a logging change.
: PRINT "Starting new log for &ProcessName#."
: SET &RET# = CHANGE_LOGGING ("&FullProcessName#")
: IF &RET# <> 0
: PRINT "ERROR: Problem changing logging. Return code: &RET#"
: ENDIF
: ENDIF
: ELSE
: PRINT "Process &FullProcessName# is NOT active!"
: ENDIF
: P
:ENDPROCESS
:CLOSE_PROCESS &HND#

The script sets the trace flags according to the values of &MyWPTraceFlags# and &MyCPTraceFlags#, and then (optionally) initiates a logging change for each process. This script can be used when troubleshooting AE problems and when collecting logs & traces for Automic Support staff. The script is meant to be used in the following way:

  1. Set the trace flags variables at the top of the script to the desired trace levels and run the script.
  2. Reproduce the problem you are troubleshooting.
  3. Set the trace flag variables back to 0 and run the script again.

If all goes well, the logs and traces with _01.txt at the end of their file names should now contain only the messages pertaining to the time window between subsequent runs of the script.

 

Enjoy!

Outcomes