Python logging and rotating files

后端 未结 4 1538
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 06:09

I have a python program that is writing to a log file that is being rotated by Linux\'s logrotate command. When this happens I need to signal my program to stop writing to

4条回答
  •  悲&欢浪女
    2020-12-14 06:56

    Since rotation is already being done by logrotate, in your signal handler you should just call logging.basicConfig(...) again and that should reopen the log file.

提交回复
热议问题