Commit Graph

295 Commits

Author SHA1 Message Date
Xtreak 2c10538d11 bpo-36903: Fix ResourceWarning in test_logging (GH-13283) 2019-05-13 16:48:51 +02:00
Riccardo Magliocchetti ca87eebb22 bpo-36015: Handle StreamHandler representaton of stream with an integer name (GH-11908) 2019-05-07 22:36:39 +01:00
Gregory P. Smith 64aa6d2000
bpo-36533: Reinit logging.Handler locks on fork(). (GH-12704)
Instead of attempting to acquire and release them all across fork
which was leading to deadlocks in some applications that had chained
their own handlers while holding multiple locks.
2019-05-07 12:18:20 -04:00
Windson yang 3d6f61edb8 bpo-36681: Remove duplicate test_regression_29220 function (GH-12894) 2019-04-22 11:49:11 -07:00
Xtreak 2dad96013c bpo-35726: Add test for QueueHandler with multiple handlers (GH-11659) 2019-04-07 08:51:27 +01:00
Rémi Lapeyre 65f64b1903 bpo-36272: Logging now propagates RecursionError (GH-12312) 2019-03-15 06:53:34 +00:00
Pablo Galindo 137b0632dc
bpo-34997: Fix test_logging.ConfigDictTest.test_out_of_order (GH-9913)
When runnint test_logging with --huntrleaks after commit
18fb1fb943, test_out_of_order fails
to raise ValueError due to the fact that the new test
test_out_of_order_with_dollar_style mutates the out_of_order
dictionary. Even if the test copies the dictionary first, the mutation
is done in a very deep level so the original one is also affected.
2018-10-16 15:17:57 +01:00
BNMetrics 18fb1fb943 bpo-34844: logging.Formatter enhancement - Ensure style and format string matches in logging.Formatter (GH-9703) 2018-10-15 19:41:36 +01:00
Cheryl Sabella d345bb4d9b bpo-34334: Don't log traceback twice in QueueHandler (GH-9537) 2018-09-26 00:00:08 +01:00
Gregory P. Smith 19003841e9
bpo-6721: Hold logging locks across fork() (GH-4071)
bpo-6721: When os.fork() was called while another thread holds a logging lock, the child process may deadlock when it tries to log.  This fixes that by acquiring all logging locks before fork and releasing them afterwards.

A regression test that fails before this change is included.

Within the new unittest itself: There is a small _potential_ due to mixing of fork and a thread in the child process if the parent's thread happened to hold a non-reentrant library call lock (malloc?) when the os.fork() happens.  buildbots and time will tell if this actually manifests itself in this test or not.  :/  A functionality test that avoids that would be a challenge.

An alternate test that isn't trying to produce the deadlock itself but just checking that the release and acquire calls are made would be the next best alternative if so.
2018-09-13 22:08:31 -07:00
Victor Stinner 31b50b8cbf
bpo-34092, test_logging: increase SMTPHandlerTest timeout (GH-8245)
Change test_logging.SMTPHandlerTest timeout from 8 seconds to 1
minute. The test failed randomly on the slow x86 Gentoo Refleaks 3.7
buildbot.
2018-07-11 12:35:38 +02:00
Xtreak 087570af6d bpo-33978: Close existing handlers before logging (re-)configuration. (GH-8008) 2018-07-02 09:57:46 +01:00
Dong-hee Na cf67d6a934 bpo-33897: Add a 'force' keyword argument to logging.basicConfig(). (GH-7873) 2018-06-25 05:11:09 +01:00
Łukasz Langa 214f18e49f
bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)
This solves a regression in logging config due to changes in BPO-23835.
2018-06-08 04:02:48 -07:00
Vinay Sajip dde9fdbe45
bpo-33165: Added stacklevel parameter to logging APIs. (GH-7424) 2018-06-05 17:24:18 +01:00
Timo Furrer 6e3ca645e7 bpo-33606: improve logging performance when logger is disabled (GH-7285)
A check has been added in Logger.isEnabledFor() to return False when the logger is disabled. This avoids unnecessary work being done when a disabled logger is used.
2018-06-01 08:29:46 +01:00
Victor Stinner 13ff24582c
bpo-32593: Drop FreeBSD 9 and older support (#5232)
Drop support of FreeBSD 9 and older.
2018-01-22 18:32:50 +01:00
Mike 53f7a7c281 bpo-32297: Few misspellings found in Python source code comments. (#4803)
* Fix multiple typos in code comments

* Add spacing in comments (test_logging.py, test_math.py)

* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02:00
xdegaye bf2b65e413
bpo-28668: test.support.requires_multiprocessing_queue is removed (GH-4560)
Skip tests with test.support.import_module('multiprocessing.synchronize')
instead when the semaphore implementation is broken or missing.
2017-12-01 08:08:49 +01:00
Łukasz Langa ce9e625445 bpo-31457: Don't omit inner ``process()`` calls with nested LogAdapters (#4044)
This used to be the case on Python 2.  Commit
212b590e11 changed the implementation for Python
3, making the `log()` method of LogAdapter call `logger._log()` directly.  This
makes nested log adapters not execute their ``process()`` method.  This patch
fixes the issue.

Also, now proxying `name`, too, to make `repr()` work with nested log adapters.

New tests added.
2017-10-19 10:24:55 -07:00
Łukasz Langa 0b6a118a45 bpo-31457: Make the `LoggerAdapter.manager` property settable (#4042)
Due to a bug in the initial fix, the setter was in fact creating a different
property.  This is now fixed.
2017-10-18 17:28:51 -07:00
Christian Heimes a170fa162d bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)
Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and
PROTOCOL_TLS_SERVER.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-15 20:27:30 +02:00
Victor Stinner b9b69003d9 bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the
thread is still alive after timeout seconds.
2017-09-14 14:40:56 -07:00
Łukasz Langa 1bbd482bcf bpo-31457: Allow for nested LoggerAdapter objects (#3551)
Some of the proxied methods use internal Logger state which isn't proxied,
causing failures if an adapter is applied to another adapter.

This commit fixes the issue, adds a new test for the use case.
2017-09-14 11:34:47 -04:00
Victor Stinner b8f4163da3 bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523)
socketserver.ThreadingMixIn now keeps a list of non-daemonic threads
to wait until all these threads complete in server_close().

Reenable test_logging skipped tests.

Fix SocketHandlerTest.tearDown(): close the socket handler before
stopping the server, so the server can join threads.
2017-09-13 01:47:22 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Victor Stinner a7719e27b3 bpo-31235: Fix ResourceWarning in test_logging (#3147) 2017-08-19 00:34:00 +02:00
Victor Stinner 6966960468 bpo-30830: test_logging uses threading_setup/cleanup (#3137)
* bpo-30830: test_logging uses threading_setup/cleanup

Replace @support.reap_threads on some methods with
support.threading_setup() in setUp() and support.threading_cleanup()
in tearDown() in BaseTest.

* bpo-30830: test_logging disables threaded socketserver tests

Disable tests because of socketserver.ThreadingMixIn leaks threads,
whereas leaking threads now makes a test to fail on buildbots.

Disable tests until socketserver is fixed: bpo-31233.

* Skip also setup_via_listener()
2017-08-18 23:47:54 +02:00
Preston Landers 6ea56d2ebc bpo-31080: Allowed logging.config.fileConfig() to accept both args and kwargs. (GH-2979) 2017-08-02 21:44:28 +01:00
favll adfe3440f6 bpo-31084: QueueHandler now formats messages correctly. (GH-2954) 2017-08-01 19:12:26 +01:00
Vinay Sajip 2543f50033 bpo-30522: Implemented a method to allow setting a logging.StreamHander's stream. (GH-2921) 2017-07-30 10:41:45 +01:00
Avram Lubkin 78c18a9b9a bpo-30962: Added caching to Logger.isEnabledFor() (GH-2752) 2017-07-30 10:36:33 +01:00
Vinay Sajip 6260d9f203 bpo-30520: Implemented pickling for loggers. (#1956)
Implemented pickling for loggers.
2017-06-06 16:34:29 +01:00
Xiang Zhang 0b4b57df96 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1676) 2017-06-01 21:11:56 +08:00
Victor Stinner 8ca2f2faef bpo-30131: test_logging now joins queue threads (#1298)
QueueListenerTest of test_logging now closes the multiprocessing
Queue and joins its thread to prevent leaking dangling threads to
following tests.

Add also @support.reap_threads to detect earlier if a test leaks
threads (and try to "cleanup" these threads).
2017-04-26 15:56:25 +02:00
Victor Stinner 4bcfa3a236 bpo-30131: Cleanup threads in test_logging (#1275)
* Use @support.reap_threads on unit tests creating threads
* Call TestCase.fail() on thread.join(timeout) failure
2017-04-25 00:41:36 +02:00
Vinay Sajip d4f5001bac Issue #29220: Merged fixes from 3.6. 2017-01-11 17:44:07 +00:00
Vinay Sajip a861d48817 Issue #292Merged fixes from 3.5. 2017-01-11 17:41:28 +00:00
Vinay Sajip 924aaae4c2 Issue #29220: Improved fix and test. 2017-01-11 17:35:36 +00:00
Vinay Sajip 8b866d5429 Closes #29220: Fixed regression in logging.getLevelName(). 2017-01-11 06:57:55 +00:00
Vinay Sajip 9ebb245db8 Closes #29177: Merged fix from 3.6. 2017-01-09 16:55:24 +00:00
Vinay Sajip 1e6499c19c Fixes #29177: Improved resilience of logging tests which use socket servers.
Thanks to Xavier de Gaye for the report and patch improvements.
2017-01-09 16:54:12 +00:00
Vinay Sajip d489ac9102 Closes #28524: added default level for logging.disable(). 2016-12-31 11:40:11 +00:00
Xavier de Gaye d178e69ad8 Issue 28668: Merge 3.5 2016-11-15 17:03:12 +01:00
Xavier de Gaye 49e8f2d204 Issue 28668: Skip tests where instanciation of multiprocessing.Queue
would raise ImportError
2016-11-15 16:57:52 +01:00
Martin Panter 94332cba0f Issue #28480: Adjust or skip tests if multithreading is disabled 2016-10-20 05:10:44 +00:00
Vinay Sajip d61910c598 Fixes #27930: improved QueueListener behaviour. 2016-09-08 01:13:39 +01:00
Vinay Sajip db8f46321f Added back test code lost during merge. 2016-09-08 01:37:03 +01:00
Serhiy Storchaka a793037d80 Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:27:26 +03:00
Vinay Sajip 1bf197eb14 Fixed #27251: corrected string/bytes handling in credentials. 2016-06-07 21:19:55 +01:00