diff --git a/CHANGELOG.md b/CHANGELOG.md index 184b3a968..5ce4f5d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - [Backup NG] Improve the Schedule's view (Replace table by list) [#3491](https://github.com/vatesfr/xen-orchestra/issues/3491) (PR [#3586](https://github.com/vatesfr/xen-orchestra/pull/3586)) - ([Host/Storage], [Sr/hosts]) add bulk deletion [#3179](https://github.com/vatesfr/xen-orchestra/issues/3179) (PR [#3539](https://github.com/vatesfr/xen-orchestra/pull/3539)) - [xo-server] Use @xen-orchestra/log for basic logging [#3555](https://github.com/vatesfr/xen-orchestra/issues/3555) (PR [#3579](https://github.com/vatesfr/xen-orchestra/pull/3579)) +- [Backup Report] Log error when job failed [#3458](https://github.com/vatesfr/xen-orchestra/issues/3458) (PR [#3593](https://github.com/vatesfr/xen-orchestra/pull/3593)) ### Bug fixes diff --git a/packages/xo-server/src/xo-mixins/jobs/index.js b/packages/xo-server/src/xo-mixins/jobs/index.js index d890b3df0..5b49e1986 100644 --- a/packages/xo-server/src/xo-mixins/jobs/index.js +++ b/packages/xo-server/src/xo-mixins/jobs/index.js @@ -290,8 +290,8 @@ export default class Jobs { runs[runJobId] = { cancel } let session + const app = this._app try { - const app = this._app session = app.createUserConnection() session.set('user_id', job.userId) @@ -316,11 +316,16 @@ export default class Jobs { app.emit('job:terminated', status, job, schedule, runJobId) } catch (error) { - logger.error(`The execution of ${id} has failed.`, { - event: 'job.end', - runJobId, - error: serializeError(error), - }) + await logger.error( + `The execution of ${id} has failed.`, + { + event: 'job.end', + runJobId, + error: serializeError(error), + }, + true + ) + app.emit('job:terminated', undefined, job, schedule, runJobId) throw error } finally { ;this.updateJob({ id, runId: null })::ignoreErrors()