Commit 30af5c42 authored by manohar's avatar manohar

Log writing enabled


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97495 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c5cd9f5d
...@@ -50,7 +50,10 @@ import ibase.webitm.ejb.sys.UtilMethods; ...@@ -50,7 +50,10 @@ import ibase.webitm.ejb.sys.UtilMethods;
public class MiscPayConfSch implements Schedule public class MiscPayConfSch implements Schedule
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
FileOutputStream fos1 = null; //FileOutputStream fos1 = null;
File filePtr ;
File logDir ;
String logDirName = "";
@Override @Override
public String schedule(String scheduleParamXML)throws Exception public String schedule(String scheduleParamXML)throws Exception
{ {
...@@ -70,9 +73,26 @@ public class MiscPayConfSch implements Schedule ...@@ -70,9 +73,26 @@ public class MiscPayConfSch implements Schedule
ibase.utility.UserInfoBean userInfo = null; ibase.utility.UserInfoBean userInfo = null;
String loginSiteCode=""; String loginSiteCode="";
String strToWrite=""; String strToWrite="";
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
String currTime = null;
Calendar calendar = Calendar.getInstance();
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-","");
try try
{ {
if(CommonConstants.J2EE_VERSION.equals("1"))
{
logDirName = CommonConstants.JBOSSHOME + File.separator + "log" ;
}
else if(CommonConstants.J2EE_VERSION.equals("2"))
{
logDirName = CommonConstants.JBOSSHOME + File.separator + "server"+ File.separator +"default"+ File.separator +"log" ;
}
logDir = new File(logDirName);
filePtr = new File(logDirName+ File.separator + "miscpaysch" + currTime + ".log");
Document dom = null; Document dom = null;
String xtraParams = "",source=""; String xtraParams = "",source="";
Node currDetail = null ; Node currDetail = null ;
...@@ -93,7 +113,7 @@ public class MiscPayConfSch implements Schedule ...@@ -93,7 +113,7 @@ public class MiscPayConfSch implements Schedule
xtraParams = "loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode+"~~loginEmpCode="+userInfo.getEmpCode(); xtraParams = "loginCode="+userInfo.getLoginCode()+"~~termId="+userInfo.getRemoteHost()+"~~loginSiteCode="+loginSiteCode+"~~loginEmpCode="+userInfo.getEmpCode();
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat()); sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
java.util.Date currentDate = new java.util.Date(); java.util.Date currentDate = new java.util.Date();
Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf1.format(currentDate)+" 00:00:00.0"); Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf1.format(currentDate)+" 00:00:00.0");
System.out.println(">>>> newsysDate is:"+newsysDate); System.out.println(">>>> newsysDate is:"+newsysDate);
...@@ -117,11 +137,11 @@ public class MiscPayConfSch implements Schedule ...@@ -117,11 +137,11 @@ public class MiscPayConfSch implements Schedule
System.out.println(">>>>After Commit Confirm Completed:"+tranId); System.out.println(">>>>After Commit Confirm Completed:"+tranId);
if(retString.indexOf("VTSUCC1") > -1) if(retString.indexOf("VTSUCC1") > -1)
{ {
strToWrite = "Payment Confirmation for Tran Id "+tranId+" is : \r\n\r\n"; strToWrite = " ["+ tranId + "] success ";
} }
else else
{ {
strToWrite = "Payment Confirmation for Tran Id "+tranId+" is : "+retString+" \r\n\r\n"; strToWrite = " ["+tranId+"] return ["+retString+"]";
} }
} }
...@@ -131,6 +151,8 @@ public class MiscPayConfSch implements Schedule ...@@ -131,6 +151,8 @@ public class MiscPayConfSch implements Schedule
conn.rollback(); conn.rollback();
System.out.println(">>>>>>>>>>Confirm Failed:"+tranId); System.out.println(">>>>>>>>>>Confirm Failed:"+tranId);
} }
writeLog( filePtr, strToWrite, true );
//System.out.println(">>>>strToWrite-----"+strToWrite); //System.out.println(">>>>strToWrite-----"+strToWrite);
//fos1.write(strToWrite.getBytes()); //fos1.write(strToWrite.getBytes());
} }
...@@ -151,17 +173,12 @@ public class MiscPayConfSch implements Schedule ...@@ -151,17 +173,12 @@ public class MiscPayConfSch implements Schedule
} }
finally finally
{ {
if(conn!=null)
{
conn.close();
conn=null;
}
try try
{ {
if(fos1!=null) if(conn!=null)
{ {
fos1.close(); conn.close();
fos1=null; conn=null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -285,5 +302,26 @@ public class MiscPayConfSch implements Schedule ...@@ -285,5 +302,26 @@ public class MiscPayConfSch implements Schedule
return retString; return retString;
} }
void writeLog(File f,String Msg,boolean flag)
{
try{
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
String currTime = null;
Calendar calendar = Calendar.getInstance();
currTime = sdf1.format(new Timestamp(System.currentTimeMillis())).toString();
currTime = currTime.replaceAll("-","");
calendar.setTime(new java.sql.Timestamp(System.currentTimeMillis()));
if(! CommonConstants.DEBUG_LEVEL.equals("0"))
{
PrintWriter pw = new PrintWriter((new FileOutputStream(f,flag)),flag);
pw.println("{" + currTime + " " + calendar.get(Calendar.HOUR)+":"+calendar.get(Calendar.MINUTE) + "}\t" + Msg);
pw.close();
}
}
catch(Exception exWm){exWm.printStackTrace();}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment