Skip to content

Commit 80c9fa7

Browse files
committed
contrib/flask: raise an exception if logging parameter is passed to ElasticAPM
1 parent f2d4584 commit 80c9fa7

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

elasticapm/contrib/flask/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def __init__(self, app=None, client=None, client_cls=Client, **defaults) -> None
8282
self.client = client or get_client()
8383
self.client_cls = client_cls
8484

85+
logging = defaults.pop("logging", None)
86+
if logging is not None:
87+
raise ValueError("Flask log shipping has been removed, drop the ElasticAPM logging parameter")
88+
8589
if app:
8690
self.init_app(app, **defaults)
8791

tests/contrib/flask/flask_tests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
pytestmark = pytest.mark.flask
5151

5252

53+
def test_logging_parameter_raises_exception():
54+
with pytest.raises(ValueError, match="Flask log shipping has been removed"):
55+
ElasticAPM(config=None, logging=True)
56+
57+
5358
def test_error_handler(flask_apm_client):
5459
client = flask_apm_client.app.test_client()
5560
response = client.get("/an-error/")

0 commit comments

Comments
 (0)