This question is a simpler version of this 4 years old question without answer Django management command doesn't show logging output from python library:
I have a command:
class Command(BaseCommand):
def handle(self, *args, **options):
...
MyParser(data)
And in MyParser:
logger = logging.getLogger(__name__)
Class MyParser:
def __init__(self, data):
logger.info('hello')
Why the logger does not display to stdout when I run the command? With a print it is OK but I need a logger
PS:
I tried this but it does not change anything
from parser import logger
root_logger = logger
root_logger.setLevel(logging.INFO)
MyParser(data)