Skip to content

Commit bf987c9

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

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

elasticapm/contrib/flask/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ 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+
if "logging" in defaults:
86+
raise ValueError("Flask log shipping has been removed, drop the ElasticAPM logging parameter")
87+
8588
if app:
8689
self.init_app(app, **defaults)
8790

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, drop the ElasticAPM logging parameter"):
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)