Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/django.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions docs/flask.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down