From 490ef61e198c39ec6fb0f5566a98e3afd0ee9520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 26 Oct 2017 13:13:21 +0200 Subject: [PATCH] If serial.log is disabled, log how to enable it That will hopefully help a bit against the endless stream of "serial .log was empty" statements on the bug tracker. Or not. Here's hope. --- src/octoprint/__init__.py | 2 +- src/octoprint/printer/standard.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index e2d32cfc..765fa308 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -216,7 +216,7 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con }, "loggers": { "SERIAL": { - "level": "CRITICAL", + "level": "INFO", "handlers": ["serialFile"], "propagate": False }, diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 7379904b..cd94590c 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -208,6 +208,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): from octoprint.logging.handlers import SerialLogHandler SerialLogHandler.on_open_connection() + if not logging.getLogger("SERIAL").isEnabledFor(logging.DEBUG): + # if serial.log is not enabled, log a line to explain that to reduce "serial.log is empty" in tickets... + logging.getLogger("SERIAL").info("serial.log is currently not enabled, you can enable it via Settings > Serial Connection > Log communication to serial.log") self._comm = comm.MachineCom(port, baudrate, callbackObject=self, printerProfileManager=self._printerProfileManager)