Reputation: 507
At the moment my exceptions are logging text and stack-trace:
throw new RequestValidationException("test exception", parameters, e);
I want to Collect all parameters for the throws exception in all methods.
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("testparam", message.toString());
throw new RequestValidationException("test exception", parameters, e);
Now i'm using a hashmap. I have to look at every method and check if it's using a parameter. This will cost me days. There are like thousands of exceptions in the code, is there a simple way to show the values?
Upvotes: 3
Views: 317
Reputation: 6692
You can use slf4j-ext for logging method parameters. They are logged at the trace level.
private static final XLogger xlogger = XLoggerFactory.getXLogger(MyClass.class);
Then you can use at start and end of your methods like this:
protected void Method1(Message aMessage){
xLogger.entry(aMessage);
...
xLogger.exit();
}
Upvotes: 2