Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Details/Log-File in Crash-Report #7

Open
colin-kiegel opened this issue Dec 10, 2021 · 2 comments
Open

Include Details/Log-File in Crash-Report #7

colin-kiegel opened this issue Dec 10, 2021 · 2 comments

Comments

@colin-kiegel
Copy link

colin-kiegel commented Dec 10, 2021

Current Situation

Notifications about crashed Cronjobs are quite simple

  • Subject: Information on crashed cron-jobs
  • Body: The following cron-jobs crashed:

Feature Request

It would be nice to include as much details as possible (gated behind a new setting)

  • time and duration of last run
  • exit code
  • log file
  • ...
@colin-kiegel
Copy link
Author

@tfamula Just to get a first impression: Would this be do-able at all with current ILIAS? Or would it require changes to ILIAS to get the log file?

Thank you! :-)

@colin-kiegel
Copy link
Author

NotifyOnCronFailure der Hochschule Luzern löst das gut- Ergebnis ist eine wesentliche informativere Mail, vgl. Gegenüberstellung für denselben beispielhaften Cronfehler (Link: CronStatusMonitor, Rechts: NotifyOnCronFailure)
image

Allerdings ist derzeit die weitere Maintenance von NotifyOnCronFailure nicht geklärt, so dass es ggf. Sinn macht, das Beste aus beiden Ansätzen in einem Plugin zusammenzuführen.


NotifyOnCronFailure holt sich die job_result_message wie folgt:

https://github.com/HochschuleLuzern/NotifyOnCronFailure/blob/39a17d6/classes/class.ilNotifyOnCronFailureNotify.php#L120-L133

            $data = ilCronManager::getCronJobData();
            $data_plugins = ilCronManager::getPluginJobs();
            
            foreach ($data_plugins as $data_plugin) {
                $data[] = $data_plugin[1];
            }

            $failed_jobs = [];
            
            foreach ($data as $job) {
                if ($job["job_result_status"] == ilCronJobResult::STATUS_CRASHED || $job["job_result_status"] == ilCronJobResult::STATUS_FAIL) {
                    $failed_jobs[] = array("job_id" => $job["job_id"], "job_result_message" => $job["job_result_message"]);
                }
            }

Der Mailtext wird dann so zusammengebaut:

https://github.com/HochschuleLuzern/NotifyOnCronFailure/blob/39a17d6/classes/class.ilNotifyOnCronFailureNotify.php#L187-L190

            $text = '';
            foreach ($failures as $failure) {
                $text .= $failure['job_id'] . ' (' . $this->cp->txt('cron_status') . ': ' . $failure['job_result_message'] . ")\n";
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant