Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Unable to Set Notice Context #9

Open
micah-williamson opened this issue Dec 7, 2020 · 0 comments
Open

Unable to Set Notice Context #9

micah-williamson opened this issue Dec 7, 2020 · 0 comments

Comments

@micah-williamson
Copy link

Because the AirbrakeAppender initializes it's own Notifier, I am unable to add a NotifierFilter to inject additional notice context.

How can I add additional context/env/param to all notices when using log4javabrake?

Notifier notifier = new Notifier(conf.getAirbrakeProjectId(), conf.getAirbrakeProjectKey());
notifier.addFilter((Notice notice) -> {
    notice.setEnvironment("instance_id", conf.getInstanceId());
    return notice;
});
Airbrake.setNotifier(notifier);

Logger logger = LogManager.getLogger("com.acme.foo"); // <- uses different notifier
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant