Hacker News new | ask | show | jobs
by ilamparithi 938 days ago
Recently did something similar for a java project using AOP. Basically adding an annotation to each method and logging the parameters before the method call and return values after the method call. Whenever there is an exception, a mail will be sent with the stacktrace along with the entire request path(including method calls, parameters and return values). Extremely useful for debugging and to proactively fix the issues.
1 comments

Curious how you do this performantly for any non-trivial codebase. Like, consider a class whose logging representation is the data it contains, which can be arbitrarily large. Generally this is not an issue because it’s only logged rarely and on designated paths where people actually care about this and it was expected to be used in that fashion. How would this work for a large object that you pass to a function repeatedly, or in a deeply nested stack trace?
The project I worked on has a non-trivial codebase. So far I haven't seen any performance issues though I was worried initially. The idea is to use it during development and beta testing and switch it off later once the application is stable enough. Might keep it on for some more time if there are no performance issues.