diff --git a/couchpotato/core/_base/scheduler/main.py b/couchpotato/core/_base/scheduler/main.py index 8c7dc2b1..6b131924 100644 --- a/couchpotato/core/_base/scheduler/main.py +++ b/couchpotato/core/_base/scheduler/main.py @@ -2,6 +2,7 @@ from apscheduler.scheduler import Scheduler as Sched from couchpotato.core.event import addEvent from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin +import logging log = CPLog(__name__) @@ -14,6 +15,9 @@ class Scheduler(Plugin): def __init__(self): + sl = logging.getLogger('apscheduler.scheduler') + sl.disabled = True + addEvent('schedule.cron', self.cron) addEvent('schedule.interval', self.interval) addEvent('schedule.start', self.start) diff --git a/couchpotato/runner.py b/couchpotato/runner.py index 62711f61..24c97568 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -24,6 +24,8 @@ def getOptions(base_path, args): dest = 'console_log', help = "Log to console") parser.add_argument('--daemon', action = 'store_true', dest = 'daemonize', help = 'Daemonize the app') + parser.add_argument('--quiet', action = 'store_true', + dest = 'quiet', help = 'No console logging') parser.add_argument('--nogit', action = 'store_true', dest = 'nogit', help = 'Running from git') @@ -69,6 +71,7 @@ def runCouchPotato(options, base_path, args): Env.set('cache', FileSystemCache(os.path.join(Env.get('cache_dir'), 'python'))) Env.set('console_log', options.console_log) Env.set('daemonize', options.daemonize) + Env.set('quiet', options.quiet) Env.set('args', args) Env.set('options', options) @@ -76,6 +79,10 @@ def runCouchPotato(options, base_path, args): debug = options.debug or Env.setting('debug', default = False, type = 'bool') Env.set('debug', debug) + # Disable server access log + server_log = logging.getLogger('werkzeug') + server_log.disabled = True + # Only run once when debugging if os.environ.get('WERKZEUG_RUN_MAIN') or not debug: @@ -86,7 +93,7 @@ def runCouchPotato(options, base_path, args): logger.setLevel(level) # To screen - if (debug or options.console_log) and not options.daemonize: + if (debug or options.console_log) and not options.daemonize and not options.quiet: hdlr = logging.StreamHandler(sys.stderr) hdlr.setFormatter(formatter) logger.addHandler(hdlr) @@ -96,10 +103,6 @@ def runCouchPotato(options, base_path, args): hdlr2.setFormatter(formatter) logger.addHandler(hdlr2) - # Disable server access log - server_log = logging.getLogger('werkzeug') - server_log.disabled = True - # Start logging & enable colors import color_logs from couchpotato.core.logger import CPLog @@ -166,4 +169,6 @@ def runCouchPotato(options, base_path, args): app.register_blueprint(api, url_prefix = '%s/%s/' % (url_base, api_key)) # Go go go! + try: log.info('Starting server on port %(port)s' % config) + except: pass app.run(**config)