2

I can easily create logs throughout the application using the logging module, but inside a django background task it does not work.

import logging
from background_task import background

log = logging.getLogger("django")

@background(schedule=1)
def do_something():
    log.info("it worked")

running do_something() does not log anything, but if I remove the decorator it works... Does anyone know how to make it work?

Akira Kotsugai
  • 1,099
  • 3
  • 12
  • 19

1 Answers1

1

Increase the schedule time and try

import logging
from background_task import background

log = logging.getLogger("django")

@background(schedule=10)
def do_something():
    log.info("it worked")