For method entry and exits, instead of the syntax below:
· LOGGER.entering(CLASSNAME, METHOD_NAME);
· LOGGER.exiting(CLASSNAME, METHOD_NAME);
instead of things like:
· LOGGER.logp(Level.INFO,CLASSNAME, METHODNAME,"entering");
· e.printStackTrace();
It is recommended to surround all level with an if statement as shown in the two examples below:
if(LOGGER.isLoggable(WsLevel.FINE)){
LOGGER.logp(Level.FINE, CLASSNAME, METHOD_NAME, "Test1: "+test2);
}
if(LOGGER.isLoggable(WsLevel.FINEST)){
LOGGER.logp(Level.FINEST, CLASSNAME, METHOD_NAME, "Test2: "+test2);
}
Instead of just
LOGGER.logp(Level.FINE, CLASSNAME, METHOD_NAME, "Test1: "+test1);
LOGGER.logp(Level.FINEST, CLASSNAME, METHOD_NAME, "Test2: "+test2);
to preserve memory during normal operation and avoid filling the String pool with objects which will not be used.
There is no need to do so with SEVERE (INFO and WARN) too as it is used with exceptions most of the time and is always enabled.
No comments:
Post a Comment