Commit Graph

435 Commits

Author SHA1 Message Date
Serhiy Storchaka
327dbbedff gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) 2025-10-30 12:52:02 +02:00
Hugo van Kemenade
872eafd2b0 gh-76007: Deprecate __version__ attribute (#138675)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-09-29 12:03:23 +03:00
Rani Pinchuk
fd8f42d3d1 gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror (GH-136796)
Don't ignore errors raised by `PyErr_WarnFormat` in `warn_about_fork_with_threads`
Instead, ignore the warnings in all test code that forks. (That's a lot of functions.)

In `test_support`, make `ignore_warnings` a context manager (as well as decorator),
and add a `message` argument to it.
Also add a `ignore_fork_in_thread_deprecation_warnings` helper for the deadlock-in-fork
warning.
2025-08-26 15:33:21 +02:00
Jelle Zijlstra
797abd1f7f gh-134657: Remove newly added private names from asyncio.__all__ (#134665) 2025-07-09 13:25:46 +05:30
Vinay Sajip
18d32fb646 gh-91555: Revert disabling of logger while handling log record. (GH-135858)
Revert "gh-91555: disable logger while handling log record (GH-131812)"

This reverts commit 2561e148ec.
2025-06-25 06:42:38 +01:00
Jeremy Cline
2bd3895fca gh-127319: Disable port reuse on HTTP, XMLRPC, and logging TCP servers (GH-135405)
Prior to issue #120485 these servers did not allow port reuse, which
makes sense as the behavior of port reuse is surprising if you're not
expecting it. It's unclear to me why these services were switched to
allow port reuse, but I believe the desired behavior (unless subclasses
opt in) is to not allow port reuse.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=2323170
2025-06-15 06:34:29 +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
Serhiy Storchaka
84a08f8629 gh-133306: Use \z instead of \Z in regular expressions in the stdlib (GH-133337) 2025-05-03 17:58:49 +03: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
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
Serhiy Storchaka
f7ceb317ae gh-71339: Use new assertion methods in test_logging (GH-128828) 2025-01-14 22:40:45 +02:00
Kumar Aditya
5892853fb7 gh-127949: deprecate asyncio.set_event_loop_policy (#128024)
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 11:35:29 +05:30
Hood Chatham
1183e4ce2f gh-127146: Emscripten clean up test suite (#127984)
Removed test skips that are no longer required as a result of Emscripten updates.
2024-12-17 07:48:23 +00:00
Irit Katriel
e97910cdb7 gh-125522 : add explicit exception types to bare excepts in tests (#125523) 2024-10-15 17:00:04 +01: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
algonell
9017b95ff2 Fix typos (#123775) 2024-09-09 14:58:26 +02:00
Bénédikt Tran
7b8328b6b3 GH-121723: Skip test_config_queue_handler_multiprocessing_context in emulated JIT CI (#122969) 2024-08-13 16:25:36 -07: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
Sam Gross
82a4dac9f6 gh-117657: Skip tests that fork with threads under TSan (#121599)
This avoids messages like:

  ThreadSanitizer: starting new threads after multi-threaded fork is not
  supported. Dying (set die_after_fork=0 to override)
2024-07-15 16:43:51 -04: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
Russell Keith-Magee
92f6d400f7 gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (#120476)
Skip tests that require multiprocessing subprocess support.
2024-06-15 08:05:18 +08: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
109e1082ea gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067) 2024-06-04 20:16:43 +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
Serhiy Storchaka
0152dc4ff5 gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065) 2024-05-16 10:25:10 +03:00
Serhiy Storchaka
02887c6428 gh-102402: Make test_relativeCreated_has_higher_precision less implementation dependent (GH-118062) 2024-04-30 17:35:19 +03:00
Victor Stinner
8f25cc9920 gh-102402: Fix logging test_relativeCreated_has_higher_precision() leak (#117985)
Fix a reference leak in test_relativeCreated_has_higher_precision()
of test_logging: don't reimport the logging the logging module.
2024-04-18 19:01:55 +02: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
Sam Gross
59864edd57 gh-117552: Add timeout in HTTPHandlerTest (#117553) 2024-04-08 10:46:56 -04: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
Donghee Na
20578a1f68 gh-112536: Add TSAN builds on Github Actions (#116872) 2024-03-16 11:10:37 +01:00
Malcolm Smith
872c0714fc gh-71052: Change Android's sys.platform from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-03-11 19:25:39 +00:00
Serhiy Storchaka
d8712fa0c7 gh-88352: Make TimedRotatingFileHandler tests more stable (GH-116409)
The tests failed (with less than 1% probability) if for example the file
was created at 11:46:03.999, but the record was emitted at 11:46:04.001,
with atTime=11:46:04, which caused an unexpected rollover. Ensure that the
tests are always run within the range of the same whole second.

Also share code between test_rollover_at_midnight and test_rollover_at_weekday.
2024-03-11 11:57:07 +02: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
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
Nikita Sobolev
8f5e7d739f gh-108303: Move smtpd to test.support (#114368)
Update test_logging.py and test_smtplib.py.
2024-01-22 14:36:29 +01:00
Vinay Sajip
842b738129 gh-113692: skip a test if multiprocessing isn't available. (GH-113704) 2024-01-09 07:47:42 +00: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