Sofia Toro
c740fe3bd0
gh-134360 Add processName attribute to `logging.Formatter` docstring (GH-134371)
2025-05-21 05:49:06 +01:00
Sebastian Pipping
2eb49d278e
gh-133577: Add parameter `formatter` to `logging.basicConfig` (GH-133578)
2025-05-14 07:45:00 +01:00
Duane Griffin
2561e148ec
gh-91555: disable logger while handling log record (GH-131812)
...
Prevent the possibility of re-entrancy leading to deadlock or infinite recursion (caused by logging triggered by logging), by disabling logging while the logger is handling log messages.
2025-05-08 13:33:06 +01:00
Mariusz Felisiak
28a2fd031e
gh-115032: Deprecate support for custom logging handlers with 'strm' argument. (GH-115314)
2025-04-27 22:18:14 +01:00
Charles Machalow
5863cd70b8
gh-132106: Ensure that running `logging.handlers.QueueListener` cannot be started again (GH-132444)
...
Prevents a thread leak
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-13 08:53:13 +01:00
Charles Machalow
517e96b9ed
gh-132106: Allow `logging.handlers.QueueListener` to be used as a context manager ( #132107 )
2025-04-12 12:00:04 +00:00
s-hamann
d7672e5d5a
gh-127712: Fix `secure` argument of `logging.handlers.SMTPHandler` (GH-127726)
...
GH-127712: Fix `secure` argument of `logging.handlers.SMTPHandler`
Python 3.12 removed support for the `keyfile` and `certfile` parameters
in `smtplib.SMTP.starttls()`, requiring a `ssl.SSLContext` instead.
`SMTPHandler` now creates a context from the `secure` tuple and passes
that to `starttls`.
2025-02-10 12:34:27 +00:00
Hod
fdcedfd3cf
gh-126400: Add TCP socket timeout to SysLogHandler to prevent blocking (GH-126716)
...
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-29 19:37:43 +00:00
Bénédikt Tran
7ffe94fb24
gh-124653: Relax (again) detection of queue API for logging handlers (GH-124897)
2024-10-07 19:42:19 +01:00
Victor Stinner
d3239976a8
gh-105376: Restore deprecated logging warn() method ( #122775 )
...
This reverts commit dcc028d924
and
commit 6c54e5d721
.
Keep the deprecated logging warn() method in Python 3.13.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-08-09 15:13:24 +02:00
Serhiy Storchaka
6094c6fc2f
gh-116263: Do not rollover empty files in RotatingFileHandler (GH-122788)
2024-08-08 09:48:11 +03:00
Bénédikt Tran
fb864c76cd
gh-121723: Relax constraints on queue objects for `logging.handlers.QueueHandler`. (GH-122154)
2024-08-02 12:16:32 +01:00
Craig Robson
e9b4ec614b
gh-105623 Fix performance degradation in logging RotatingFileHandler (GH-105887)
...
The check for whether the log file is a real file is expensive on NFS
filesystems. This commit reorders the rollover condition checking to
not do the file type check if the expected file size is less than the
rotation threshold.
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2024-06-27 16:44:40 +00:00
Janek Nouvertné
7d9c68513d
gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872)
2024-06-27 08:09:01 +01:00
Serhiy Storchaka
1500a23f33
gh-120683: Fix an error in logging.LogRecord timestamp (GH-120709)
...
The integer part of the timestamp can be rounded up, while the millisecond
calculation truncates, causing the log timestamp to be wrong by up to 999 ms
(affected roughly 1 in 8 million timestamps).
2024-06-24 09:50:39 +03:00
Idan Kapustian
192d17c3fd
gh-120485: Add an override of `allow_reuse_port` on classes subclassing `socketserver.TCPServer` (GH-120488)
...
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-06-16 13:15:03 +01:00
Vinay Sajip
983efcf15b
gh-119819: Update logging configuration to support joinable multiproc… (GH-120090)
...
gh-119819: Update logging configuration to support joinable multiprocessing manager queues.
2024-06-05 07:25:47 +01:00
Vinay Sajip
99d945c0c0
gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030)
2024-06-04 13:20:50 +01:00
Kaundur
dce14bb2dc
gh-118868: logging QueueHandler fix passing of kwargs (GH-118869)
...
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-06-04 12:48:05 +01:00
Vinay Sajip
6d0bb43232
gh-117975: Ensure flush level is checked when configuring a logging MemoryHandler. (GH-117976)
2024-04-17 13:55:18 +01:00
Douglas Thor
1316692e8c
gh-102402: Fix floating point math issue by using `time.time_ns()` in `logging.LogRecord` (GH-102412)
2024-04-16 10:44:57 +01:00
Vinay Sajip
00baaa21de
[docs] Fix typo in docstring and add example to logging cookbook. (GH-117157)
2024-03-22 17:25:51 +00:00
Serhiy Storchaka
269051d20e
gh-90535: Fix support of interval>1 in logging.TimedRotatingFileHandler (GH-116220)
...
Fix support of interval values > 1 in logging.TimedRotatingFileHandler
for when='MIDNIGHT' and when='Wx'.
2024-03-16 12:29:42 +02:00
Victor Stinner
61831585b6
Replace stat.ST_xxx usage with os.stat().st_xxx ( #116501 )
...
Modernize code to use the new API which avoids the usage of the stat
module just to read os.stat() members.
* Sort logging.handlers imports.
* Rework reopenIfNeeded() code to make it easier to follow.
* Replace "not self.stream" with "self.stream is None".
2024-03-08 18:49:09 +01:00
Serhiy Storchaka
87faec28c7
gh-115809: Improve TimedRotatingFileHandler.getFilesToDelete() (GH-115812)
...
Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.
2024-03-03 09:42:08 +02:00
Serhiy Storchaka
fee86fd9a4
gh-88352: Fix logging.TimedRotatingFileHandler (GH-116191)
...
* Do not overwrite already rolled over files. It happened at midnight or
during the DST change and caused the loss of data.
* computeRollover() now always return the timestamp larger than the
specified time.
* Fix computation of the rollover time during the DST change.
2024-03-01 17:50:08 +02:00
Gabriele Catania
113687a838
gh-93205: When rotating logs with no namer specified, match whole extension (GH-93224)
2024-02-21 23:09:06 +02:00
Mariusz Felisiak
d823c23549
gh-115032: Update DictConfigurator.configure_formatter() comment about `fmt` retry. (GH-115303)
2024-02-13 08:47:40 +00:00
Serhiy Storchaka
91822018ee
gh-115233: Fix an example in the Logging Cookbook (GH-115325)
...
Also add more tests for LoggerAdapter.
Also support stacklevel in LoggerAdapter._log().
2024-02-12 18:24:45 +02:00
Vinay Sajip
e21754d7f8
gh-114706: Allow QueueListener.stop() to be called more than once. (GH-114748)
2024-01-30 12:34:18 +00:00
Tristan Pank
07236f5b39
gh-114494: Change logging docstring to bool for exec_info (GH=114558)
2024-01-26 21:48:22 +02:00
Vinay Sajip
67655d8ad5
gh-111615: Fix regression in QueueHandler configuration. (GH-111638)
2023-12-27 09:35:15 +00:00
Vinay Sajip
a5f29c9faf
gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943)
2023-11-09 18:55:22 +00:00
Łukasz Langa
6d42759c5e
gh-111276: Clarify docs and comments about the role of LC_CTYPE ( #111319 )
...
Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0:
https://docs.python.org/2/library/string.html#deprecated-string-functions
Also, fix a comment in logging about locale-specific behavior of `str.lower()`.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-27 11:43:01 +02:00
Dale Collison
74723e1110
gh-109461: Update logging module lock to use context manager ( #109462 )
...
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-27 18:26:41 +02:00
Peeyush Aggarwal
8d4052075e
gh-103384: Generalize the regex pattern `BaseConfigurator.INDEX_PATTERN` to allow spaces and non-alphanumeric characters in keys. (GH-103391)
...
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-25 09:15:26 +01:00
Romuald Brunet
a482e5bf00
gh-76913: Add "merge extras" feature to LoggerAdapter (GH-107292)
2023-08-15 08:23:54 +01:00
Nikita Sobolev
8fcee6b279
gh-107710: Speed up `logging.getHandlerNames` function ( #107711 )
2023-08-07 14:52:36 +01:00
Jochem Boersma
5e5a34ac3a
gh-107028: tiny textual changes in logging docs and docstrings (GH-107029)
2023-07-22 21:43:18 +01:00
Irit Katriel
fb32f35c05
gh-102799: replace internal sys.exc_info() call by sys.exception() ( #106746 )
2023-07-14 20:41:24 +01:00
Victor Stinner
dcc028d924
gh-105376: Remove logging.warn() and LoggerAdapter.warn() ( #106553 )
2023-07-09 10:32:50 +02:00
Ariel Eizenberg
99b00efd5e
gh-106238: Handle KeyboardInterrupt during logging._acquireLock() (GH-106239)
...
Co-authored-by: Ariel Eizenberg <ariel.eizenberg@pagaya.com>
2023-07-06 08:02:22 +01:00
Victor Stinner
6c54e5d721
gh-105376: Remove logging.Logger.warn() method ( #105377 )
2023-06-06 18:35:51 +00:00
Prince Roshan
12f1581b0c
gh-103606: raise RuntimeError if config file is invalid or empty ( #104701 )
...
(this adjusts new code) raise RuntimeError if provided config file is invalid or empty, not ValueError.
2023-05-20 22:26:49 +00:00
Prince Roshan
152227b569
gh-103606: Improve error message from logging.config.FileConfig (GH-103628)
2023-05-18 05:20:47 +01:00
Bar Harel
8f54302ab4
gh-103357: Add logging.Formatter defaults support to logging.config fileConfig and dictConfig (GH-103359)
2023-04-12 08:35:56 +01:00
Irit Katriel
44bd3fe570
gh-102799: use exception instance instead of sys.exc_info() ( #102885 )
2023-03-31 11:23:02 +01:00
cemysce
1d1bb95abd
gh-99811: Use correct variable to search for time in format string (GH-99812)
...
Use correct variable to search for asctime
2022-11-28 18:25:03 +00:00
Vinay Sajip
f6b1e4048d
gh-98307: Add docstring and documentation for SysLogHandler.createSocket (GH-98319)
...
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-16 09:15:46 +01:00
Vinay Sajip
ac4ddab405
gh-90195: Unset logger disabled flag when configuring it. (GH-96530)
2022-09-03 13:38:38 +01:00