1

I was looking for a way to disable the Sitecron execution reports. I could not find any setting in the config file that could do this.

So has anyone tried disabling the execution report generation? Is there any way to disable it out of the box?

1 Answer 1

1

Having looked at Sitecron module code, I found that there is no out-of-the-box setting that can enable or disable creation of execution reports.

One possible way to prevent creation of execution reports without code changes is to make sure that executionReportFolderItem is null in the method CreateExecutionReport() and the code within condition if (executionReportFolderItem != null) is not executed (see code of the method CreateExecutionReport() below).

You can achieve this either by removing the item with ID {E62862B1-03DF-4752-A290-9B505806C515} or denying read permission to this item for the user account that creates execution reports.

private void CreateExecutionReport(string jobName, ID itemID, string logData, string lastRunTime)
{
    try
    {
        string contextDbName = Settings.GetSetting(SitecronConstants.SettingsNames.SiteCronContextDB, "master");
        Database contextDb = Factory.GetDatabase(contextDbName);

        //The bucket is not publishable so it will stay only on the master. This way it will not cause any publishing delays.
        Item executionReportFolderItem = contextDb.GetItem(new ID(SitecronConstants.ItemIds.SiteCronExecutionReportsFolderID));
        if (executionReportFolderItem != null)
        {
            string newItemName = ItemUtil.ProposeValidItemName(string.Concat(jobName, DateTime.Now.ToString(" dddd MMMM dd yyyy HH mm ss ffff")));

            using (new SecurityDisabler())
            {
                Item executionReport = executionReportFolderItem.Add(newItemName, new TemplateID(SitecronConstants.Templates.SiteCronExecutionReportTemplateID));
                if (executionReport != null)
                {
                    executionReport.Editing.BeginEdit();
                    {
                        executionReport[SitecronConstants.FieldNames.LastRunUTC] = lastRunTime;
                        executionReport[SitecronConstants.FieldNames.Log] = logData;
                        if (!ID.IsNullOrEmpty(itemID))
                            executionReport[SitecronConstants.FieldNames.SitecronJob] = itemID.ToString();
                    }
                    executionReport.Editing.EndEdit();
                }
            }
        }
    }
    catch (Exception ex)
    {
        Log.Error("SiteCron ERROR creating Execution report: " + ex.Message, ex, this);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.