Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugsnag logging #19308

Closed
krisgerhard opened this issue Aug 9, 2021 · 6 comments
Closed

Bugsnag logging #19308

krisgerhard opened this issue Aug 9, 2021 · 6 comments
Labels
kind/extension-proposal Discuss and Propose new extensions

Comments

@krisgerhard
Copy link

krisgerhard commented Aug 9, 2021

Description

A Quarkus Extension to send (error) logs to a Bugsnag Error Monitoring.
Bugsnag homepage

There is an official extension for sentry (https://quarkus.io/guides/logging-sentry) but it is not the only popular error monitoring tool out there. I (and hopefully many others) would benefit from supporting Bugsnag as well.

In fact I have already implemented and used this extension in production for about two weeks now, and figured I might as well help make it available for others. It's separated in a repository -> https://github.com/krisgerhard/logging-bugsnag.
Couple of remarks about the implementation.

  • I acknowledge it is not usable for quarkiverse as is. It is meant to show the simplicity of the extension.
  • Most of the work is done by bugsnag-java library BUT there is some additional code to support tracking RESTEasy HTTP requests. For this I've also created a PR in bugsnag-java repository but I would not count on them mergeing it any time soon so this code could as well be part of this extension until the time comes.

Interested in this extension, please +1 via the emoji/reaction feature of GitHub (top right).

Configuration suggestion

https://docs.bugsnag.com/platforms/java/other/configuration-options/
quarkus.log.bugsnag.enable=true
quarkus.log.bugsnag.api-key=YOUR_API_KEY
quarkus.log.bugsnag.minimum-event-level=WARN
quarkus.log.bugsnag.filters=password, credit_card_number
quarkus.log.bugsnag.ignored-classes=java.io.IOException, com.example.Custom
quarkus.log.bugsnag.notify-release-stage=production, development
quarkus.log.bugsnag.project-packages=com.company.package1, com.company.package2
quarkus.log.bugsnag.release-stage=development
quarkus.log.bugsnag.send-threads=false
quarkus.log.bugsnag.timeout=5000

@krisgerhard krisgerhard added the kind/extension-proposal Discuss and Propose new extensions label Aug 9, 2021
@stuartwdouglas
Copy link
Member

Note that you can also use the Quarkiverse logback support to use the logback appender: https://docs.bugsnag.com/platforms/java/other/configuring-logback/

@krisgerhard
Copy link
Author

Note that you can also use the Quarkiverse logback support to use the logback appender: https://docs.bugsnag.com/platforms/java/other/configuring-logback/

That's correct. Although at the moment Bugsnag does not know how to attach JAX-RS request data to the report.
It's arguable whether this should be the idea of the extension but it sure helps quarkus users towards using Bugsnag.

@krisgerhard
Copy link
Author

@stuartwdouglas I started looking into the Logback extension. How would you inject bugsnag api key without committing it into repository?

logback.xml

<appender name="BUGSNAG" class="com.bugsnag.BugsnagAppender">
  <apiKey>your-api-key-here</apiKey>
</appender>

@stuartwdouglas
Copy link
Member

You should be able to use ${my-key}, which would get picked up from standard Quarkus config (e.g. a MY_KEY env var, or -Dmy-key= system prop).

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 18, 2022

/cc @aloubyansky, @gastaldi, @maxandersen

@krisgerhard
Copy link
Author

krisgerhard commented Mar 31, 2023

@stuartwdouglas Sorry for late reply. Logback extension + BugsnagAppender works as expected. Closing the issue.

Edit: Works as expected with some additional reflection configuration*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/extension-proposal Discuss and Propose new extensions
Projects
None yet
Development

No branches or pull requests

3 participants