[Python] Python- How to flush the log? (django)

Discussão em 'Python' iniciado por Stack, Março 8, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working with Django-nonrel on Google App Engine, which forces me to use logging.debug() instead of print().

    The "logging" module is provided by Django, but I'm having a rough time using it instead of print().

    For example, if I need to verify the content held in the variable x, I will put
    logging.debug('x is: %s' % x). But if the program crashes soon after (without flushing the stream), then it never gets printed.

    So for debugging, I need debug() to be flushed before the program exits on error, and this is not happening.

    Continue reading...

Compartilhe esta Página