This document describes an older version of Celery (2.1). For the latest stable version please go here.

Logging - celery.log


class celery.log.ColorFormatter(msg, use_color=True)
class celery.log.LoggingProxy(logger, loglevel=None)

Forward file object to logging.Logger instance.

  • logger – The logging.Logger instance to forward to.
  • loglevel – Loglevel to use when writing messages.

When the object is closed, no write requests are forwarded to the logging object anymore.

closed = False

This object is not buffered so any flush() requests are ignored.


Always returns False. Just here for file support.

loglevel = 40
mode = 'w'
name = None

writelines(sequence_of_strings) -> None.

Write the strings to the file.

The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string.

class celery.log.SilenceRepeated(action, max_iterations=10)

Only log action every n iterations.

celery.log.emergency_error(logfile, message)

Emergency error logging, for when there’s no standard file descriptors open because the process has been daemonized or for some other reason.

celery.log.get_default_logger(loglevel=None, name='celery')

Get default logger instance.

Parameters:loglevel – Initial log level.
celery.log.get_task_logger(loglevel=None, name=None)
celery.log.redirect_stdouts_to_logger(logger, loglevel=None)

Redirect sys.stdout and sys.stderr to a logging instance.

  • logger – The logging.Logger instance to redirect to.
  • loglevel – The loglevel redirected messages will be logged as.
celery.log.setup_logger(loglevel=30, logfile=None, format='[%(asctime)s: %(levelname)s/%(processName)s] %(message)s', colorize=False, name='celery', root=True, **kwargs)

Setup the multiprocessing logger. If logfile is not specified, then stderr is used.

Returns logger object.

celery.log.setup_logging_subsystem(loglevel=30, logfile=None, format='[%(asctime)s: %(levelname)s/%(processName)s] %(message)s', colorize=False, **kwargs)
celery.log.setup_task_logger(loglevel=30, logfile=None, format='[%(asctime)s: %(levelname)s/%(processName)s] [%(task_name)s(%(task_id)s)] %(message)s', colorize=False, task_kwargs=None, propagate=False, **kwargs)

Setup the task logger. If logfile is not specified, then stderr is used.

Returns logger object.

Previous topic

Message Routers - celery.routes

Next topic

Event Snapshots -

This Page