I have been doubting for a long time whether or not to have a logger in methods (usually helper methods) like the one below.
Whether we can print it in the method or print the response where the method is called.
public String getAddNewUserUrl()
{
String url = null;
String mode = null;
try
{
log.info("Inside getAddNewUserUrl "); // Can u use logs like this.
mode = new ModeUtil().getMode();
if("local".equalsIgnoreCase(mode) || "staging".equalsIgnoreCase(mode))
{
url = ResourceBundle.getBundle("ApplicationResources").getString("staging.url");
}
else
{
url = ResourceBundle.getBundle("ApplicationResources").getString("staging.url");
}
log.info("The url is : " + url); // Can u use logs like this
}
catch(Exception e)
{
e.printStackTrace();
log.info("Exception in the method getMode ::"+e.getMessage());
}
return url;