I have nice functional code roughly of next shape (ComponentRegistry.java
):
public void doExport() {
config.exports().forEach((key, type) -> {
...
}
}
The problem with it that when it comes to log4j statements it produces next output:
ComponentRegistry lambda$doExport$1
Where actual method name comes after "lambda" keyword and then there are two hints about anonymous classes ($
). It simply not as good as direct method call logging.
I was wondering whether anyone came with way to properly label lambdas in log4j output or stacktraces because it would be awesome.
If you want to give it a name, don't use a lambda (which is explicitly an anonymous function). Instead break it out into its own class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With