Questions tagged [python-logging]

"logging" is a python module used for logging output to the console. Mainly used for debugging.

0votes
2answers
28views

Python logging: access custom logger from several files

How can I declare a custom logger with custom logging method in the main.py and then use the same object (!) in all the files that main.py uses: eg #main.py import logging from additional import bar ...
0votes
0answers
19views

Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

I have a main process which makes use of different other modules. And these modules also use other modules. I need to log all the logs into single log file. Due to use of TimedRotatingFileHandler, my ...
0votes
0answers
16views

Why don't StreamHandler and FileHandler support the base Handler's level kwarg?

I recently explored Python 3.10's logging module a bit and discovered that the logging.Handler base class has a level=NOTSET kwarg in its __init__() signature. Naively, I tried to feed my ...
0votes
0answers
42views

multiprocessing + logging + tqdm progress bar flashing

Can someone experienced with tqdm help me with the following reproducer please? import itertools import logging import multiprocessing import random import sys import time import tqdm from tqdm....
0votes
1answer
21views

How do I dump Python's logging configuration?

How do I dump the current configuration of the Python logging module? For example, if I use a module that configures logging for me, how can I see what it has done?
  • 2,758
0votes
1answer
20views

Python logging, how to prevent functions from library from logging?

I'm making a project and using a library from the requirements of the project. The library implements logging and automatically logs to a file, when I call its functions. Now, I'm implementing logging ...
0votes
0answers
23views

Python Logger with WSGI on Apache creates empty file

I have a Python Flask application for which I want to use the Python Logger to capture errors. The application is deployed on Apache with WSGI. When I test the error logging using the debug server, ...
1vote
1answer
36views

Set a Minimum Width for Python Rich Logging (RichHandler)

I am using RichHander to format log output inside Python. While this works great locally, when I run inside GitLab, it seems to default to using a terminal that is 80 characters wide. This makes the ...
  • 484
1vote
0answers
51views

Set-up python logging on a separate file - Foundry Code Repository

de-facto standard in Foundry is log additional messages inside the main pyspark logger, as by foundry - pyspark logging doc. Logging output appears in both your output dataset's log files, and in ...
1vote
2answers
54views

Override Info, Warn, Error of a third party library logging

I am new to Python (background is .Net) and working on a Python application that is a wrapper around a third-party library. The third-party Python library uses standard logging. I need to intercept ...
0votes
1answer
34views

Use different logger handlers for different levels

I'd like to send all logs (including debug) to a file and to print only logs with a level of info or higher to stderr. Currently, every module begins with this: logger = logging.getLogger(__name__) I ...
0votes
1answer
32views

Problems about python logging.config.dictConfig

I study logging module recording some message recently. I want to pass a self-defined log path to the dict configuration. For the sake of calling it conveniently, I encapsulate some code into a class. ...
-1votes
1answer
60views

Python Logging - How to log as JSON str?

I have a Python Django app where we need to log using below code snippet to allow ELK to index the log record as JSON logger.info(json.dumps({'level':'INFO','data':'some random data'}) I have to use ...
0votes
1answer
28views

Python logger not showing DEBUG level messages even though handler level is set to debug

I'm trying to create a logger that prints "debug" messages. I've defined handlers with the correct level set. Still it only prints warning levels and above. This is my code: import logging #...
0votes
0answers
15views

Unable to generate the logs into a file in Python using logger module

I'm trying to generate the logs to a file called 'app.log' but it is giving me error. If I comment that this line logging.basicConfig(filename='app.log', level=logging.INFO) then the program do not ...

153050per page