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

Implement net.bytebuddy.asm.Advice.ExceptionHandler to log exceptions in agent log #841

Open
felixbarny opened this issue Sep 12, 2019 · 3 comments
Assignees
Labels
diagnostics Diagnosability of the agent itself logging application logging instrumentation and support technical-debt Technical debt

Comments

@felixbarny
Copy link
Member

Currently, we are using net.bytebuddy.asm.Advice.ExceptionHandler.Default#PRINTING which means the exceptions may not be in the agent logs. We should create a custom net.bytebuddy.asm.Advice.ExceptionHandler which logs the exception with the agent logger.

If possible make that generic enough so that we can contribute that to Byte Buddy

@felixbarny felixbarny added diagnostics Diagnosability of the agent itself technical-debt Technical debt logging application logging instrumentation and support labels Sep 12, 2019
@eyalkoren
Copy link
Contributor

eyalkoren commented Sep 12, 2019

OR... contribute to ByteBuddy the ability to allow usage of plain Java dependency (as opposed to dependency on ByteBuddy interface) like java.util.function.Consumer<Throwable>, but preferably not Java 8 dependent

@felixbarny
Copy link
Member Author

@raphw any recommendations on the approach? We’d like to contribute this to Byte Buddy if possible.

Can the advice templating be re-used for this? Something like

@OnAdviceException
private static void onException(@Thrown Throwable t) {
   // handle t
}

@raphw
Copy link
Contributor

raphw commented Sep 14, 2019

Not a bad idea, actually. One could write the exception to a free offset and make it available like that. This way, all the other annotations that work in (at)Enter advice would also work.

I have not looked into how difficult this would be to implement but it would certainly be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostics Diagnosability of the agent itself logging application logging instrumentation and support technical-debt Technical debt
Projects
None yet
Development

No branches or pull requests

4 participants