diff --git a/Tautulli.py b/Tautulli.py index 74a9789d..64a919eb 100755 --- a/Tautulli.py +++ b/Tautulli.py @@ -106,8 +106,8 @@ def main(): plexpy.QUIET = True # Do an intial setup of the logger. - logger.initLogger(console=not plexpy.QUIET, log_dir=False, - verbose=plexpy.VERBOSE) + # Require verbose for pre-initilization to see critical errors + logger.initLogger(console=not plexpy.QUIET, log_dir=False, verbose=True) try: plexpy.SYS_TIMEZONE = tzlocal.get_localzone() diff --git a/plexpy/__init__.py b/plexpy/__init__.py index ea41a3fc..73f7e63a 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -65,7 +65,7 @@ SYS_LANGUAGE = None SYS_ENCODING = None QUIET = False -VERBOSE = True +VERBOSE = False DAEMON = False CREATEPID = False PIDFILE = None @@ -122,6 +122,7 @@ def initialize(config_file): global CONFIG global CONFIG_FILE + global VERBOSE global _INITIALIZED global CURRENT_VERSION global LATEST_VERSION @@ -152,6 +153,8 @@ def initialize(config_file): if not log_writable and not QUIET: sys.stderr.write("Unable to create the log directory. Logging to screen only.\n") + VERBOSE = VERBOSE or bool(CONFIG.VERBOSE_LOGS) + # Start the logger, disable console if needed logger.initLogger(console=not QUIET, log_dir=CONFIG.LOG_DIR if log_writable else None, verbose=VERBOSE) diff --git a/plexpy/config.py b/plexpy/config.py index 469f3f47..42fb524a 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -603,6 +603,7 @@ _CONFIG_DEFINITIONS = { 'UPDATE_LABELS': (int, 'General', 1), 'UPDATE_LIBRARIES_DB_NOTIFY': (int, 'General', 1), 'UPDATE_NOTIFIERS_DB': (int, 'General', 1), + 'VERBOSE_LOGS': (int, 'Advanced', 1), 'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1), 'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1), 'WEBSOCKET_MONITOR_PING_PONG': (int, 'Advanced', 0), diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 7c82ef21..474e2122 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -2667,8 +2667,11 @@ class WebInterface(object): @requireAuth(member_of("admin")) def toggleVerbose(self, **kwargs): plexpy.VERBOSE = not plexpy.VERBOSE - logger.initLogger(console=not plexpy.QUIET, - log_dir=plexpy.CONFIG.LOG_DIR, verbose=plexpy.VERBOSE) + + plexpy.CONFIG.__setattr__('VERBOSE_LOGS', plexpy.VERBOSE) + plexpy.CONFIG.write() + + logger.initLogger(console=not plexpy.QUIET, log_dir=plexpy.CONFIG.LOG_DIR, verbose=plexpy.VERBOSE) logger.info(u"Verbose toggled, set to %s", plexpy.VERBOSE) logger.debug(u"If you read this message, debug logging is available") raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + "logs")