Skip to content

Commit

Permalink
log: don't log to qubes.log file on disk, only stderr
Browse files Browse the repository at this point in the history
stderr already ends goes to syslog. Stop duplicating the messages to
/var/lib/qubes/qubes.log (or /tmp/qubes.log), so logrotate doesn't have
to restart qubesd - causing problems such as aborted backups.

Fixes QubesOS/qubes-issues#5004
  • Loading branch information
rustybird committed Feb 4, 2021
1 parent c2c8db0 commit a2c8d7f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
8 changes: 0 additions & 8 deletions linux/system-config/logrotate-qubes
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
endscript
}

/var/log/qubes/qubes.log {
create 0640 root qubes
su root qubes
postrotate
/bin/systemctl restart qubesd.service >/dev/null 2>/dev/null || true
endscript
}

/var/log/qubes/vm-*.log {
su root qubes
}
2 changes: 1 addition & 1 deletion qubes/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ def on_domain_pre_deleted(self, event, vm):
raise qubes.exc.QubesVMInUseError(
vm,
'Domain is in use: {!r};'
'see /var/log/qubes/qubes.log in dom0 for '
"see 'journalctl -u qubesd -e' in dom0 for "
'details'.format(
vm.name))
except AttributeError:
Expand Down
15 changes: 0 additions & 15 deletions qubes/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,6 @@ def enable():
handler_console.setFormatter(formatter_console)
logging.root.addHandler(handler_console)

if os.path.exists('/var/log/qubes'):
log_path = '/var/log/qubes/qubes.log'
else:
# for tests, travis etc
log_path = '/tmp/qubes.log'
old_umask = os.umask(0o007)
try:
handler_log = logging.FileHandler(log_path, 'a', encoding='utf-8')
fcntl.fcntl(handler_log.stream.fileno(),
fcntl.F_SETFD, fcntl.FD_CLOEXEC)
finally:
os.umask(old_umask)
handler_log.setFormatter(formatter_log)
logging.root.addHandler(handler_log)

logging.root.setLevel(logging.INFO)

def enable_debug():
Expand Down

0 comments on commit a2c8d7f

Please sign in to comment.