Rich's logging handler produces an inline logging line in VSCode notebooks when the logging should be redirected to a file, and this file never gets writen.
import logging
from rich.logging import RichHandler
from rich.console import Console
from pathlib import Path
logging.basicConfig(
level=logging.DEBUG,
handlers=[
RichHandler(console=Console()), # inline display
RichHandler( # writing log into test.log
console=Console(file=Path("test.log").open("w", encoding="utf_8"))
),
],
)
logging.info("Hello world")
This code produces a duplicate logging and the file "test.log" remins empty.
Rich's logging handler produces an inline logging line in VSCode notebooks when the logging should be redirected to a file, and this file never gets writen.
This code produces a duplicate logging and the file "test.log" remins empty.
Everything works fine when running from terminal.
Platform
Click to expand
``` ╭─────────────────────────