<jupyter_start><jupyter_text>Configure through code.Restart the kernel here.<jupyter_code>import logging
import sys
root_logger = logging.getLogger()
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter("%(levelname)s: %(message)s")
handler.setFormatter(formatter)
root_logger.addHandler(handler)
root_logger.setLevel("INFO")

logging.info("Hello logging world")<jupyter_output>INFO: Hello logging world<jupyter_text>Configure with dictConfig.Restart the kernel here.<jupyter_code>import logging
from logging.config import dictConfig

dictConfig({
    "version": 1,
    "formatters": {
        "short":{
            "format": "%(levelname)s: %(message)s",
        }
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "formatter": "short",
            "stream": "ext://sys.stdout",
            "level": "DEBUG",
        }
    },
    "loggers": {
        "": {
            "handlers": ["console"],
            "level": "INFO"
        }   
    }
})
logging.info("Hello logging world")<jupyter_output>INFO: Hello logging world<jupyter_text>Configure with basicConfig.Restart the kernel here.<jupyter_code>import sys
import logging
logging.basicConfig(
    level="INFO",
    format="%(levelname)s: %(message)s",
    stream=sys.stdout
)
logging.info("Hello there!")<jupyter_output>INFO: Hello there!<jupyter_text>Configure with fileconfig.Restart the kernel here.<jupyter_code>import logging
from logging.config import fileConfig
fileConfig("logging-config.ini")
logging.info("Hello there!")<jupyter_output>INFO: Hello there!
{'fraction_non_alphanumeric': 0.13684871311989957, 'fraction_numerical': 0.0006277463904582549, 'mean_word_length': 3.9968652037617556, 'pattern_counts': {'":': 14, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '1122', 'license': 'MIT', 'n_tokens_mistral': 500, 'n_tokens_neox': 491, 'n_words': 96, 'path': '01_Workshop-master/Chapter06/Exercise94/Exercise94.ipynb', 'repo_name': 'Anna-MarieTomm/Learn_Python_with_Anna-Marie', 'size': '1593'}