By fabriziochami
via javacodegeeks.com
Published: Jan 17 2011 / 17:35
Application logging is a critical but often misunderstood part of a system. Our latest JCP partner, Tomasz Nurkiewicz, has submitted a number of posts describing the basic principles of proper application logging. I decided to aggregate them in a more compact format and present them to you. Let's see his suggestions for clean and helpful logs.
Comments
kellyfj replied ago:
Great article - a must read for java developers who are writing anything that needs to be monitored or debugged by mere mortals!
raveman replied ago:
great stuff, just some things i disagree with.
log.debug("Returning user ids: {}", collect(users, "id")); should be in log.isDebugEnabled(), most of us work for people that are really into premature optimalization and if the boss is using something, because it creates 3 objects and not 4 than this is a huge problem. I don't want to fight with him over this.
catch(NullPointerException e) is not that bad, but i feel it should be catch(Exception e), do you really care if your debug code is perfect? do you test your debug code?i feel its a code that can be deleted just like that.
Voters For This Link (50)
Voters Against This Link (0)