How to accurately trace the execution logs of scheduled jobs

mugi-san
Kilo Sage

Hello, Everyone.

 

I found the sys_scheduler_job_history table, but unfortunately, it doesn't seem to record the start time, end time, or success/failure status.

I believe that outputting messages to the system log and then searching through them to find what I need is not a very "smart" or efficient implementation.

Does anyone know if there is a standard table or feature that records the start time, end time, and execution status of scheduled jobs?

5 REPLIES 5

Sanjay191
Kilo Patron

Hi @mugi-san 

The standard way to track scheduled job execution is through System Diagnostics:

  • System Diagnostics → Scheduled Jobs Dashboard
    Provides execution details such as start time, end time, duration, and status.

  • System Diagnostics → Transactions
    Each scheduled job run generates a transaction showing precise timing and execution information.

    Sanjay191_0-1770019041998.png

     


    If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
    Thank You

Thanks, @Sanjay191 .

While the dashboard you shared displays information from the sys_scheduler_job_history table, please note that it does not record precise start/end times or the success/failure status. It is primarily for monitoring processing duration rather than indicating whether the job schedule itself executed successfully.

Regarding the transaction table, I believe tracking will be difficult because the transaction logs do not capture information searchable by job name, and similarly, the transaction end times are not recorded.

Regards.

Ankur Bawiskar
Tera Patron

@mugi-san 

that's correct, you won't get exact start time, end time and any success/error details

you need to handle that using gs.info() statements and use try catch block to throw any exception

Something like this

(function() {

    try {
        gs.info("My Scheduled Job ABC started" + new GlideDateTime());

        // your code

        gs.info("My Scheduled Job ABC ended" + new GlideDateTime());
    } catch (ex) {
        gs.info("Exception in scheduled job ABC" + ex);
    }

})();

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@mugi-san 

Thank you for marking my response as helpful.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader