As developers we should always choose the elegant way to do things.
One of them, is writing the log messages. Logging is important as it's the only way to see what your users/application has done or doing. Hence, it should be done elegantly. :-)
For example, if you need to write a log like this:
logger.info("records updated for user:"+ userId + "of org id:" + orgId) ;
Instead, you can use String.format(), and pass formatted string like this:
logger.info(String.format( "records updated for user:%s of org id: %s", userId, orgId) ) ;
No comments:
Post a Comment