@@ -0,0 +1,1384 @@
+package logtool.handlers;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Collection;%0Aimport java.util.Enumeration;%0Aimport java.util.Properties;%0A%0Apublic class LogUtil %7B%0A%09%0A%09/*%0A%09 * Utility method that replaces the default log file name suffixing it with the server name.%0A%09 * %0A%09 */%0A%09%0A%09public String createCustomLogFileName(String logFileName, String serverType, String server, String cluster)%7B%0A%09%09String customLogName = %22%22;%0A%09%09Properties envprop = new Properties();%0A%09%09InputStream inputStream = null;%0A%09%09inputStream = getClass().getResourceAsStream( %22/%22+serverType+%22.properties%22 );%0A%09%09try %7B%0A%09%09%09envprop.load(inputStream);%0A%09%09%7D catch (IOException e1) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09e1.printStackTrace();%0A%09%09%7D%0A%09%09Enumeration%3CObject%3E keys = envprop.keys();%0A%09%09String envType = %22%22;%0A%09%09while(keys.hasMoreElements())%7B%0A%09%09%09envType = keys.nextElement().toString();%0A%09%09%09String servers = envprop.getProperty(envType);%0A%09%09%09if(servers.contains(server))%7B%0A%09%09%09%09System.out.println(%22Server is present%22);%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09if(logFileName.endsWith(%22.log%22))%7B%0A%09%09%09String logFirstName = logFileName.substring(0, logFileName.length()-4);%0A%09%09%09customLogName = logFirstName+%22_%22+envType+%22_%22+cluster+%22_%22+server+%22.log%22;%0A%09%09%09System.out.println(%22Custom Log File Name is ::%22+customLogName);%0A%09%09%7D%0A%09%09else%7B%0A%09%09%09customLogName = logFileName+%22_%22+envType+%22_%22+server;%0A%09%09%7D%0A%09%09return customLogName;%0A%09%7D%0A%7D%0A

Create LogUtil.java