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

feat: Debug output for scheduled jobs (--debug in crontab) #1681

Merged
merged 19 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,13 @@ def scheduleMode(self, profile_id = None):
def setScheduleMode(self, value, profile_id = None):
self.setProfileIntValue('schedule.mode', value, profile_id)

def debugSchedule(self, profile_id = None):
buhtz marked this conversation as resolved.
Show resolved Hide resolved
#?Enable debug output to system log for schedule mode.
return self.profileBoolValue('schedule.debug', False, profile_id)

def setDebugSchedule(self, value, profile_id = None):
self.setProfileBoolValue('schedule.debug', value, profile_id)

def scheduleTime(self, profile_id = None):
#?Position-coded number with the format "hhmm" to specify the hour
#?and minute the cronjob should start (eg. 2015 means a quarter
Expand Down Expand Up @@ -1756,7 +1763,7 @@ def cronCmd(self, profile_id):
cmd += '--profile-id %s ' % profile_id
if not self._LOCAL_CONFIG_PATH is self._DEFAULT_CONFIG_PATH:
cmd += '--config %s ' % self._LOCAL_CONFIG_PATH
if logger.DEBUG:
if logger.DEBUG or self.debugSchedule(profile_id):
cmd += '--debug '
cmd += 'backup-job'
if self.redirectStdoutInCron(profile_id):
Expand Down
9 changes: 9 additions & 0 deletions qt/settingsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ def __init__(self, parent):

self.comboSchedule.currentIndexChanged.connect(self.scheduleChanged)

self.cbDebugSchedule = QCheckBox(self)
self.cbDebugSchedule.setText(_('Enable logging of debug messages'))
self.cbDebugSchedule.setToolTip(('Write debug-level messages into the system log. Warning: Use only to diagnose problems since it creates a lot of output.'))
buhtz marked this conversation as resolved.
Show resolved Hide resolved
glayout.addWidget(self.cbDebugSchedule, 8, 0)

#
layout.addStretch()
scrollArea.setWidget(layoutWidget)
Expand Down Expand Up @@ -1348,6 +1353,8 @@ def updateProfile(self):
self.config.scheduleRepeatedUnit())
self.updateSchedule(self.config.scheduleMode())

self.cbDebugSchedule.setChecked(self.config.debugSchedule())

# TAB: Include
self.listInclude.clear()

Expand Down Expand Up @@ -1584,6 +1591,8 @@ def saveProfile(self):
self.comboScheduleRepeatedUnit.itemData(
self.comboScheduleRepeatedUnit.currentIndex()))

self.config.setDebugSchedule(self.cbDebugSchedule.isChecked())

# auto-remove
self.config.setRemoveOldSnapshots(
self.cbRemoveOlder.isChecked(),
Expand Down