Skip to content

Commit

Permalink
Fix log flood
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamek authored Sep 25, 2018
1 parent f64ecc4 commit d1ffb75
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions blacklist/bin/blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def setup_logging(name: str=None, level: int=logging.DEBUG):
formatter = CustomFormatter(fmt, datefmt)

console_handler = logging.StreamHandler(sys.stdout)
console_handler.setLevel(logging.ERROR if log_to_disk else logging.DEBUG)
console_handler.setLevel(level)
console_handler.setFormatter(formatter)

root = logging.getLogger()
Expand Down Expand Up @@ -485,8 +485,9 @@ def celerydev():

@command
def celerybeat():
setup_logging('celerybeat')
app = create_app(parse_options(), no_sql=True)
options = parse_options()
setup_logging('celerybeat', logging.DEBUG if options.DEBUG else logging.WARNING)
app = create_app(options, no_sql=True)
Logging._setup = True
celery_args = ['celery', 'beat', '-C', '--pidfile', OPTIONS['--pid'], '-s', OPTIONS['--schedule']]
with app.app_context():
Expand All @@ -495,8 +496,9 @@ def celerybeat():

@command
def celeryworker():
setup_logging('celeryworker{}'.format(OPTIONS['--name']))
app = create_app(parse_options(), no_sql=True)
options = parse_options()
setup_logging('celeryworker{}'.format(OPTIONS['--name']), logging.DEBUG if options.DEBUG else logging.WARNING)
app = create_app(options, no_sql=True)
Logging._setup = True
celery_args = ['celery', 'worker', '-n', OPTIONS['--name'], '-C', '--autoscale=10,1', '--without-gossip']
with app.app_context():
Expand Down

0 comments on commit d1ffb75

Please sign in to comment.