mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-03 07:03:39 +00:00
[Log] Fix crash logging to Windows protected folder
Have the log dir be a protected windows folder and Deluge crashes. Windows blocks access to the dir and so it fails. It will fail trying to write to any protected folder. Should probably just pass on the error maybe and maybe log to stdout and log a message saying access was blocked or something. .\deluge-debug -L debug -l E:\Documents\deluge.log ... Failed to execute script 'deluge-debug-script' due to unhandled exception! Closes: https://dev.deluge-torrent.org/ticket/3502 Closes: https://github.com/deluge-torrent/deluge/pull/358
This commit is contained in:
parent
222aeed2f3
commit
8b0c8392b6
@ -155,7 +155,12 @@ def setup_logger(
|
||||
handler_cls = getattr(
|
||||
logging.handlers, 'WatchedFileHandler', logging.FileHandler
|
||||
)
|
||||
handler = handler_cls(filename, mode=filemode, encoding='utf-8')
|
||||
try:
|
||||
handler = handler_cls(filename, mode=filemode, encoding='utf-8')
|
||||
except FileNotFoundError:
|
||||
handler = logging.StreamHandler(stream=output_stream)
|
||||
log = logging.getLogger(__name__)
|
||||
log.error(f'Unable to write to log file `{filename}`')
|
||||
else:
|
||||
handler = logging.StreamHandler(stream=output_stream)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user