[Python] Kaggle Notebook does not Print Logs

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    my Kaggle-Notebook does not print Outputs.

    import logging
    import sys

    # noinspection SpellCheckingInspection,SpellCheckingInspection,SpellCheckingInspection,SpellCheckingInspection,PyArgumentList
    def defaultLogger(name="fashiondataset", level=logging.DEBUG, handlers=None,
    format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s'):
    handlers = handlers if handlers else [logging.StreamHandler(sys.stdout)]

    logging.basicConfig(level=level, format=format, handlers=handlers)

    logger = logging.getLogger(name)

    logging.getLogger("matplotlib").setLevel(logging.WARNING)
    logging.getLogger("nltk_data").setLevel(logging.WARNING)
    logging.getLogger("pysndfx").setLevel(logging.WARNING)
    logging.getLogger('selenium.webdriver.remote.remote_connection').setLevel(logging.WARNING)
    logging.getLogger('connectionpool').setLevel(logging.WARNING)
    logging.getLogger("requests").setLevel(logging.WARNING)
    logging.getLogger("urllib3").setLevel(logging.WARNING)

    return logger
    print("Testing Logger")
    logger = defaultLogger()
    logger.info("Logging Info Test")
    logger.debug("Logging Debug Test")
    logger.error("Logging Error Test")
    print("Testing Logger [DONE]")


    Output:

    Testing Logger
    Testing Logger [DONE]


    I also tried to add logging.getLogger(name).setLevel(logging.DEBUG) but it does not Change anything. TQDM / Tensorflow Progressbars are working.

    Edit:// sys.stdout.write("test") Works

    Continue reading...

Compartilhe esta Página