938 questions
2
votes
1
answer
60
views
Angle Embedder in Python Messing Up Logging Config
I wrote another question on this earlier, but could not pinpoint the issue on my side, here, I am giving a minimal reproducible code.
System
Angle version 0.5.6
UV 0.8.22
Python 3.12
Ubuntu 24.04
I ...
2
votes
1
answer
66
views
Why are ERROR logging messages reflected in the INFO logging file?
I wanted to print INFO and ERROR file separately in Python logging. When I use ERROR level, it's writing into both LEVEL defined files.
log_config.json:
{
"version": 1,
"...
1
vote
2
answers
105
views
logger from Jupyter notebook: does not work unless calling the root logger at least once
I would like to see the logging produced by some Python code from within a Jupyter notebook (logging version '0.5.1.2', python 3.12).
If I run the following code:
import logging
logger = logging....
1
vote
0
answers
56
views
Is there a reason not to replace the default logging.Handler lock with a multiprocessing.RLock to synchronize multiprocess logging
I've got some code that, for reasons not germane to the problem at hand:
Must write very large log messages
Must write them from multiple multiprocessing worker processes
Must not interleave the logs ...
3
votes
1
answer
85
views
How to prevent error on shutdown with Logging Handler / QObject?
In order to show logging messages in a PyQt GUI, I'm using a custom logging handler that sends the logRecord as a pyqtSignal.
This handler inherits from both QObject and logging.Handler.
This works as ...
1
vote
1
answer
294
views
PySide6 signal not emitting properly when passed to decorator
I have this decorator in python 3.11 that sends a signal encoding the arguments to a function call that it decorates, here:
def register_action(signal=None):
def decorator(func):
def ...
0
votes
0
answers
34
views
How to write logs with the current date and time to a Python file and use Yaml configuration file
import logging
import os
from pathlib import Path
from pydantic import BaseModel, Field, field_validator
# Configure logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
...
0
votes
0
answers
30
views
How to omit exc_info from logs when using coloredlogs in Python?
See this question about sending exc_info to a log file but not to the console using Python's logging module.
I want the exact same behavior, except that I'm using coloredlogs. How can I do this?
...
0
votes
1
answer
281
views
How to prevent FastAPI from sending the exceptions to stdout
I have this application and app.exception_handler correctly handles the exceptions that arise. There is one problem though, i.e., it does not stop the exception to be displayed in the stdout. Is there ...
0
votes
1
answer
53
views
Get package level logs into webservice between logging and structlog
So the situation is the following:
multiple internal packages written in python which do rarely log and if only use, these use the basic python logging module, since this is as far as I have read ...
0
votes
2
answers
82
views
Logger does not inherit config from parent process
Consider the following minimal setup:
/mymodule
├── __init__.py
├── main.py
└── worker.py
__init__.py is empty
main.py:
import sys
import logging
import multiprocessing
from test.worker import ...
0
votes
3
answers
59
views
How do I log when a function is called using counter and python logging?
I'm trying to log every time the function "Hello" finds 1.png. Is there a way to do this using counter or some other method, it would then log it into "anomaly.log" using logging, ...
1
vote
1
answer
45
views
Why does using `logging.Formatter` prevent widget from being deleted?
Here is a MCVE, very simple piece of code creating a QMainWindow, with a central empty QWidget:
import sys
from PyQt5.QtWidgets import QWidget
class MyWidget(QWidget):
"""QWidget ...
1
vote
1
answer
61
views
Logging Inheritance in Python
I am currently developing a core utils package where I want to set some logging properties (I know that this is not best practice, but it´s for interal purposes and intended to generate logs). When I ...
0
votes
0
answers
83
views
Loguru OSError. Fail randomly during process
Im using loguru and watch for file creation in a folder. I have two loguru logger one output to the console and one output to a log file
logger.add(os.path.join(log_dir, "loghandler_{time:...
-3
votes
2
answers
250
views
Python Logging : name 'log' is not defined [closed]
I am using python logging to write debug information to a file and print it to my screen :
logger=logging.getLogger()
logger.setLevel(logging.INFO)
file_handler = logging.FileHandler("std.log&...
0
votes
1
answer
78
views
Python Logging not getting the desired caller class and line number
I have a python class wrapper to the logging functionality.
My problem with these solutions is the logging options "%(asctime)s:[%(filename)s->%(funcName)s():%(lineno)s] %(levelname)s>> %...
0
votes
1
answer
65
views
How to print errors like python does by default?
Considering the following errornous function:
def inner():
raise Exception("message")
If I run the function I get an error like:
Traceback (most recent call last):
File "/...
-1
votes
2
answers
62
views
emit different logs in different format based on condition like security events, normal software operation events etc to the std out
I am stuck at situation where i have to
emit logs in different format based on condition like security events, normal software operation events etc to the std out.
example
lets say
security events ...
4
votes
1
answer
60
views
How can I subclass logging.Logger without breaking %(filename) in logging.Formatter's interpolation syntax
I am trying to write a custom logging.Logger subclass which is mostly working, but I run into issues when trying to use a logging.Formatter that includes the interpolated value %(filename) in the ...
3
votes
2
answers
125
views
Is there a way to print incremental time instead of absolute time with Python logging
When using Python logging, asctime is very handy in looking at the hotspots in code. However, I have to decode or post-process the log to show incremental time taken between each log message.
logging....
0
votes
1
answer
156
views
How can I make a threadsafe logging handler subclass that triggers events in the main Qt loop?
I have a PySide6 application that uses threading and logging. My logger has a custom handler defined below, which pops up a messagebox that requires user attention for higher level logging events:
...
1
vote
1
answer
54
views
Logging configuration does not take effect [duplicate]
logging.basicConfig(
filename=f"{output_location}/log.txt",
format="{asctime} - {levelname} - {filename}: {message}",
datefmt = "%d %b %H:%M",
...
-1
votes
1
answer
36
views
Not working with different levels of programming in Python for logging and for the browser?
Don't the different logging levels in Python (v3.11.4) logging work for a file and for telegrams?
So the logs of the WARNING level and above go both to the Telegram and to the file, and the logs of ...
0
votes
0
answers
393
views
How can I fix a 'socket.gaierror: [Errno 11001] getaddrinfo failed' when trying to use an SMTPHandler in Python 'logging'?
I am currently trying to log using the SMTPHandler class from Python's logging module. The logger is instantiated just fine, but fails when calling _socket.getaddrinfo even though it is being passed ...