# APM recognizes all logs as errors

**URL:** <https://discuss.elastic.co/t/apm-recognizes-all-logs-as-errors/154150>\
**Category:** APM\
**Created:** [October 26, 2018, 8:52am UTC](https://discuss.elastic.co/t/apm-recognizes-all-logs-as-errors/154150 "2018-10-26T08:52:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [October 26, 2018, 8:52am UTC](https://discuss.elastic.co/t/apm-recognizes-all-logs-as-errors/154150/1 "2018-10-26T08:52:19Z")

</div>

I'm using APM on a flask application with logbook.

Here is how I register LogBook handlers:

```auto
from elasticapm.handlers.logbook import LogbookHandler as ElasticHandler

...

    if not offline:
        # Sentry
        sentry.init_app(app=app)
        sentry_handler = SentryHandler(sentry.client, level='WARNING') 
        logger.handlers.append(sentry_handler)

        # Elastic APM
        apm = ElasticAPM(app)
        elastic_handler = ElasticHandler(client=apm.client, bubble=True)
        logger.handlers.append(elastic_handler)

```

Here is how I use logger:

```auto
logger.info('App created with `{0}` config'.format(app.config['CONFIG_NAME']), stack=False)

```

Since I already have Sentry, I just want to use Elastic APM to centralize my logs. But on the APM panel in Kibana, all the logs as treated as errors. Is there any way to adjust this behavior? Thanks!

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [October 26, 2018, 9:31am UTC](https://discuss.elastic.co/t/apm-recognizes-all-logs-as-errors/154150/2 "2018-10-26T09:31:35Z")

</div>

Hi @fr0der1c

for centralized logging, we recommend to use a [filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-getting-started.html), possibly in combination with Logstash and/or Elasticsearch Ingest Node. This is a much more efficient way to get log files into Elasticsearch than using the Elastic APM Python agent, as those tools are specifically optimized for log shipping.

The log handlers that come with the APM Python agent are better suited for logging errors, as they collect a large amount of contextual information (like stack traces, local variables, etc). These aren't needed in most cases for informational logs and therefore only create overhead both in your app as well as when indexing and storing data in Elasticsearch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 16, 2018, 5:31am UTC](https://discuss.elastic.co/t/apm-recognizes-all-logs-as-errors/154150/3 "2018-11-16T05:31:37Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
