diff --git a/moonraker/app.py b/moonraker/app.py index 6e68444..9040ee8 100644 --- a/moonraker/app.py +++ b/moonraker/app.py @@ -132,9 +132,10 @@ class MoonrakerApp: # Register handlers logfile = config['system_args'].get('logfile') if logfile: - self.register_static_file_handler("moonraker.log", logfile) + self.register_static_file_handler( + "moonraker.log", logfile, force=True) self.register_static_file_handler( - "klippy.log", DEFAULT_KLIPPY_LOG_PATH) + "klippy.log", DEFAULT_KLIPPY_LOG_PATH, force=True) self.auth.register_handlers(self) def listen(self, host, port): @@ -197,10 +198,10 @@ class MoonrakerApp: self.wsm.register_local_handler(api_def, callback) logging.info(msg) - def register_static_file_handler(self, pattern, file_path): + def register_static_file_handler(self, pattern, file_path, force=False): if pattern[0] != "/": pattern = "/server/files/" + pattern - if os.path.isfile(file_path): + if os.path.isfile(file_path) or force: pattern += '()' elif os.path.isdir(file_path): if pattern[-1] != "/": diff --git a/moonraker/plugins/file_manager.py b/moonraker/plugins/file_manager.py index 4687f0b..955af60 100644 --- a/moonraker/plugins/file_manager.py +++ b/moonraker/plugins/file_manager.py @@ -77,8 +77,10 @@ class FileManager: # Register log path log_file = paths.get('log_file') - log_path = os.path.normpath(os.path.expanduser(log_file)) - self.server.register_static_file_handler("klippy.log", log_path) + if log_file is not None: + log_path = os.path.normpath(os.path.expanduser(log_file)) + self.server.register_static_file_handler( + "klippy.log", log_path, force=True) def register_directory(self, root, path): if path is None: