Logging configuration.

The Celery instances logging section: Celery.log.

Sets up logging for the worker and other programs, redirects standard outs, colors log output, patches logging related compatibility fixes, and so on.

Module Contents


TaskFormatter() Formatter for tasks, adding the task name and id.
Logging(self,app) Application logging setup (app.log).
class TaskFormatter

Formatter for tasks, adding the task name and id.

class Logging(app)

Application logging setup (app.log).

setup(loglevel=None, logfile=None, redirect_stdouts=False, redirect_level="WARNING", colorize=None, hostname=None)
redirect_stdouts(loglevel=None, name="celery.redirected")
setup_logging_subsystem(loglevel=None, logfile=None, format=None, colorize=None, hostname=None, **kwargs)
_configure_logger(logger, logfile, loglevel, format, colorize, **kwargs)
setup_task_loggers(loglevel=None, logfile=None, format=None, colorize=None, propagate=False, **kwargs)

Setup the task logger.

If logfile is not specified, then sys.stderr is used.

Will return the base task logger object.

redirect_stdouts_to_logger(logger, loglevel=None, stdout=True, stderr=True)

Redirect sys.stdout and sys.stderr to logger.


logger (logging.Logger): Logger instance to redirect to. loglevel (int, str): The loglevel redirected message

will be logged as.
supports_color(colorize=None, logfile=None)
colored(logfile=None, enabled=None)
setup_handlers(logger, logfile, format, colorize, formatter=ColorFormatter, **kwargs)

Create handler from filename, an open stream or None (stderr).

setup_logger(name="celery", *args, **kwargs)

Deprecated: No longer used.

get_default_logger(name="celery", **kwargs)