0
votes

I can't understand if Elastic APM for Java should capture logs from slf4j or it can track only exceptions? I have Spring Boot service that uses slf4j but I can't find log entries in apm index. Can anybody clarify the expectation? Thank you

2

2 Answers

1
votes

Elastic-apm-agent-java automatically capture exceptions when you use slf4j implementation Logger#error("message", Throwable).

More information you can find here

0
votes

Logging is separate from APM / tracing, but can be integrated.

https://github.com/elastic/ecs-logging-java is a curated logging library that will also correlate the trace IDs, so you can tie both together.

Keep using SLF4J and just add the right logging backend. The output can then be picked up by Filebeat (as described in the repository) and you're ready to go.