Jupyter notebook does not print logs to the output cell

后端 未结 4 1568
一个人的身影
一个人的身影 2021-01-17 15:27

I am currently using Jupyter notebook and I would like to force it to print out Python logs to the output cell.

I am using old notebook tha

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 15:59

    None of the workarounds suggested here worked for me for me, but the below did, maybe it will help somebody else.

    Using python 3.4.3, jupyter-client==4.1.1, jupyter-core==4.0.6

    import logging
    logger = logging.getLogger(__name__)
    logger.setLevel(logging.INFO)
    
    logger.info("hello")
    

    INFO:main:hello

提交回复
热议问题