From c2c4e8054381c6bbbc2d71368b17c73f7729408d Mon Sep 17 00:00:00 2001 From: Benjamin Wohlwend Date: Wed, 9 Oct 2019 13:41:03 +0200 Subject: [PATCH 1/2] clarify that our log handlers shouldn't be used for "normal" log shipping --- docs/django.asciidoc | 14 ++++++++++---- docs/flask.asciidoc | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/django.asciidoc b/docs/django.asciidoc index 7fbd44a66..27a4cc154 100644 --- a/docs/django.asciidoc +++ b/docs/django.asciidoc @@ -191,11 +191,17 @@ ELASTIC_APM = { [float] [[django-logging]] -=== Logging +=== Integrating with Python logging -For fine-grained control over logging use Python's built-in logging module. -If you are new to how the logging module works together with Django, read more -https://docs.djangoproject.com/en/1.7/topics/logging/[in the Django documentation]. +To easily send Python `logging` messages as "error" objects to Elasticsearch, +we provide a `LoggingHandler` which you can use in your logging setup. +The log messages will be enriched with a stack trace, data from the request, and more. + +NOTE: the intended use case for this handler is to send high priority log messages (e.g. log messages with level `ERROR`) + to Elasticsearch. For normal log shipping, we recommend using {filebeat-ref}[filebeat]. + +If you are new to how the `logging` module works together with Django, read more +https://docs.djangoproject.com/en/2.1/topics/logging/[in the Django documentation]. An example of how your `LOGGING` setting could look: diff --git a/docs/flask.asciidoc b/docs/flask.asciidoc index 4133fed0b..1f6b338ee 100644 --- a/docs/flask.asciidoc +++ b/docs/flask.asciidoc @@ -158,6 +158,7 @@ apm = ElasticAPM(app, logging=True) NOTE: using `logging=True` can lead to high number of logs being sent to Elastic APM. We recommend to always limit logging with Elastic APM to a high level (`WARNING` or `ERROR`). +For shipping of less urgent logs, we recommend to use {filebeat-ref}[filebeat]. For fine-grained control, you can initialize a logging handler and add it, just as you would with any other handler. From 5605e977288dc736bd520197260ed60c9c75de46 Mon Sep 17 00:00:00 2001 From: Benjamin Wohlwend Date: Wed, 9 Oct 2019 18:44:48 +0200 Subject: [PATCH 2/2] remove unnecessary whitespace Co-Authored-By: Brandon Morelli --- docs/django.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/django.asciidoc b/docs/django.asciidoc index 27a4cc154..d544765ca 100644 --- a/docs/django.asciidoc +++ b/docs/django.asciidoc @@ -198,7 +198,7 @@ we provide a `LoggingHandler` which you can use in your logging setup. The log messages will be enriched with a stack trace, data from the request, and more. NOTE: the intended use case for this handler is to send high priority log messages (e.g. log messages with level `ERROR`) - to Elasticsearch. For normal log shipping, we recommend using {filebeat-ref}[filebeat]. +to Elasticsearch. For normal log shipping, we recommend using {filebeat-ref}[filebeat]. If you are new to how the `logging` module works together with Django, read more https://docs.djangoproject.com/en/2.1/topics/logging/[in the Django documentation].