Sitecore Job Viewer – see what Sitecore is doing in the background

This simple .aspx page has become one of my most used tools when working with Sitecore. It’s a job viewer, displaying which jobs are running and which jobs are finished:

Job Viewer

Sitecore Job Viewer

A Sitecore job is a thread running in the background. Jobs can run in parallel or in sequence: Jobs that share the same name are queued and executed in the order they arrived.

Getting a list of all jobs are pretty simple. This returns the jobs sorted by the time they were added to the queue:

public IEnumerable<Sitecore.Jobs.Job> Jobs
    return Sitecore.Jobs.JobManager.GetJobs().OrderBy(job => job.QueueTime);

For each job you can extract all information about the job you need. My application lists the most used data, and when you hover the mouse over one line, it displays more info, including who started the job, and all messages added to the job:

Job Details

Job Details

All of this in a simple .aspx page that can be uploaded to the /sitecore modules/shell/ folder on an ad-hoc basis to see what the heck Sitecore is doing.

The code is simple. Copy it from here, paste it into a jobs.aspx page and upload the thing to your Sitecore.

<%@ Page language="c#" EnableEventValidation="false" AutoEventWireup="true" %>

<script runat="server">

  void Page_Load(object sender, System.EventArgs e)

  public IEnumerable<Sitecore.Jobs.Job> Jobs
      if (!cbShowFinished.Checked)
        return Sitecore.Jobs.JobManager.GetJobs().Where(job => job.IsDone == false).OrderBy(job => job.QueueTime);
      return Sitecore.Jobs.JobManager.GetJobs().OrderBy(job => job.QueueTime);

  protected string GetJobText(Sitecore.Jobs.Job job)
    return string.Format("{0}\n\n{1}\n\n{2}", job.Name, job.Category, GetJobMessages(job));

  protected string GetJobMessages(Sitecore.Jobs.Job job)
    System.Text.StringBuilder sb = new StringBuilder();
    if (job.Options.ContextUser != null)
      sb.AppendLine("Context User: " + job.Options.ContextUser.Name);
    sb.AppendLine("Priority: " + job.Options.Priority.ToString());
    foreach (string s in job.Status.Messages)
    return sb.ToString();

  protected string GetJobColor(Sitecore.Jobs.Job job)
    if (job.IsDone)
      return "#737373";
    return "#000";

  protected void cbShowFinished_CheckedChanged(object sender, EventArgs e)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <title>Job Viewer</title>
    <link href="/default.css" rel="stylesheet">
  <body style="font-size:14px">
    <form runat="server">

      <div style="padding:10px; background-color:#efefef; border-bottom:solid 1px #aaa; border-top:solid 1px white">
        <div style="float:left; width:200px; padding-top:4px">
          <asp:CheckBox ID="cbShowFinished" runat="server" Text="Show finished jobs" Checked="false" OnCheckedChanged="cbShowFinished_CheckedChanged" AutoPostBack="true" />
        <div style="float:right;">
          <asp:Button ID="btnRefresh" runat="server" Text="Refresh" BackColor="Green" ForeColor="White" Width="100px" Height="30px" />
        <div style="clear:both;height:1px">&nbsp;</div>

      <div style="padding-top:0px">
        <asp:Repeater ID="repJobs" runat="server" DataSource="<%# Jobs %>">
            <table style="width:100%">
              <thead style="background-color:#eaeaea">
            <tr style="background-color:beige; color:<%# GetJobColor((Container.DataItem as Sitecore.Jobs.Job)) %>" title="<%# GetJobText((Container.DataItem as Sitecore.Jobs.Job)) %>">
                <%# Sitecore.StringUtil.Clip((Container.DataItem as Sitecore.Jobs.Job).Name, 50, true) %>
                <%# Sitecore.StringUtil.Clip((Container.DataItem as Sitecore.Jobs.Job).Category, 50, true) %>
                <%# (Container.DataItem as Sitecore.Jobs.Job).Status.State %>
                <%# (Container.DataItem as Sitecore.Jobs.Job).Status.Processed %> /
                <%# (Container.DataItem as Sitecore.Jobs.Job).Status.Total %>
                <%# (Container.DataItem as Sitecore.Jobs.Job).QueueTime.ToLocalTime() %>



About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in Sitecore 5, Sitecore 6, c#, Sitecore 7, Sitecore 8 and tagged , , , . Bookmark the permalink.

5 Responses to Sitecore Job Viewer – see what Sitecore is doing in the background

  1. Jan Bluemink says:

    I have something similar to check if a publish task is running, see IsPublishTaskRunning.aspx in

  2. Aman says:

    Thanks for this amazing utility!

  3. This is a nice tool, i used it during one of my upgrade project. Enhanced it a little more for security purpose and placed it behind sitecore authentication. This is how i did it,

    Inherited JobViewer from Sitecore.sitecore.admin.AdminPage

    and callled

    protected override void OnInit(EventArgs e)
    base.CheckSecurity(true); //Required!

  4. Pingback: Sitecore 7 – Disable indexing – It is not enough to set Indexing.UpdateInterval to 00:00:00. | Alan Coates – Sitecore/.NET blog

  5. This post has worked great for me for a while….but now Sitecore 7.2 Update 6 (and possibly future versions) has added a page like this to the out-of-the-box admin pages.

    Also added are PublishQueueStats and EventQueueStats pages, which can also be useful.

    Thanks for leading the way Brian!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s