Some code I wrote was sent back to me during peer review, telling me to add logging to the start of each case in a switch statement in a servlet (Java, if that matters), so if something goes wrong, we can see where. I figured that doesn't make sense, as we log entire stack traces anyway, but the response I got to that was
"It's standard practise throughout the entire industry."
They didn't have time to debate, which is fair enough, and I'll do what they say. But this hasn't been my experience in other companies. I just want to know, is it really some kind of standard practise? What is it useful for?
As an example of what I mean:
switch (task) {
case VIEW:
logger.info("inside VIEW for taskPage");
{...}
case EDIT:
logger.info("inside EDIT for taskPage");
{...}
switch
. All kinds of situations useswitch
statements, from central dispatching logic to trivial formatting logic. What was probably meant that it is standard to log branches of central, important logic such as the dispatching within an important servlet.