Commit be83b5ce authored by jshaikh's avatar jshaikh

Latest Changes merged in HRLogWriter file

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@211957 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 17329e24
...@@ -45,7 +45,7 @@ public class HRLogWriter ...@@ -45,7 +45,7 @@ public class HRLogWriter
private Timestamp startDateTime = null; private Timestamp startDateTime = null;
private boolean isJobIdCreated = false; private boolean isJobIdCreated = false;
FileOutputStream fileWriterLog = null; FileOutputStream fileWriterLog = null;
//FileOutputStream output = null;
public String getTermId() { public String getTermId() {
return termId; return termId;
} }
...@@ -471,6 +471,16 @@ public class HRLogWriter ...@@ -471,6 +471,16 @@ public class HRLogWriter
if("N".equalsIgnoreCase(getLogLocationType())) if("N".equalsIgnoreCase(getLogLocationType()))
{ {
System.out.println("Log file name : "+getLogFileName()); System.out.println("Log file name : "+getLogFileName());
try {
fileWriterLog = new FileOutputStream(getLogFileName(), true);
System.out.println("FileOutputStream output path:::: " + fileWriterLog);
setFileWriterLog(fileWriterLog);
}
catch(Exception e)
{
setLogWriterFlag(-1);
setErrorCode("VBFILEOPEN");
}
} }
} }
catch (Exception e) catch (Exception e)
...@@ -552,7 +562,29 @@ public class HRLogWriter ...@@ -552,7 +562,29 @@ public class HRLogWriter
if(asErrCode != null && asErrCode.trim().length() > 0) if(asErrCode != null && asErrCode.trim().length() > 0)
{ {
lsStr = asErrCode; lsStr = asErrCode;
asErrCode = getToken(lsStr,"~t"); // Modified on 16/09/2019[To avoid duplicate string].Start
// asErrCode = getToken(lsStr,"~t");
if (lsStr.indexOf("~t") > -1)
{
String[] strTemp = lsStr.split("~t");
asErrCode = strTemp[0];
lsStr = strTemp[1];
if(lsStr != null)
{
lsStr = lsStr.trim();
}
else
{
lsStr = "";
}
}
else
{
asErrCode = lsStr.trim();
lsStr = "";
}
// Modified on 16/09/2019[To avoid duplicate string].End
} }
...@@ -616,7 +648,7 @@ public class HRLogWriter ...@@ -616,7 +648,7 @@ public class HRLogWriter
System.out.println("Inside HRLogWriter.gfLogWriter method...."); System.out.println("Inside HRLogWriter.gfLogWriter method....");
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
FileOutputStream output = null;
String sql = ""; String sql = "";
String lsStr = "", lsMsg = "", lsErr = "", lsReturnErrcode = "", lsSeverity = "I" , lsErrorCode = "", lsErrorCode1 = ""; String lsStr = "", lsMsg = "", lsErr = "", lsReturnErrcode = "", lsSeverity = "I" , lsErrorCode = "", lsErrorCode1 = "";
String lsMsgStr = "",lsDescr = "", lsCurrentProcess = "", lsActivity = "" , lsMsgType = "",jobId = "",logLocationType = ""; String lsMsgStr = "",lsDescr = "", lsCurrentProcess = "", lsActivity = "" , lsMsgType = "",jobId = "",logLocationType = "";
...@@ -738,9 +770,8 @@ public class HRLogWriter ...@@ -738,9 +770,8 @@ public class HRLogWriter
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy hh:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy hh:mm:ss");
String todayDateTime = sdf.format(cal.getTime()); String todayDateTime = sdf.format(cal.getTime());
output = new FileOutputStream(getLogFileName(), true); fileWriterLog = getFileWriterLog();
System.out.println("FileOutputStream output path:::: " + output); fileWriterLog.write((getLineNo() + "\t" + todayDateTime +" - "+ lsStr + "\r\n").getBytes());
output.write((getLineNo() + "\t" + todayDateTime +" - "+ lsStr + "\r\n").getBytes());
} }
if("B".equalsIgnoreCase(logLocationType) || "S".equalsIgnoreCase(logLocationType)) if("B".equalsIgnoreCase(logLocationType) || "S".equalsIgnoreCase(logLocationType))
...@@ -796,11 +827,6 @@ public class HRLogWriter ...@@ -796,11 +827,6 @@ public class HRLogWriter
{ {
try try
{ {
if(output != null)
{
output.close();
}
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
...@@ -837,9 +863,23 @@ public class HRLogWriter ...@@ -837,9 +863,23 @@ public class HRLogWriter
try try
{ {
// Modified on 16/09/2019 [Should not convert case and should write as is happening in PB].Start
/*
processID = getProcessId().trim().toUpperCase(); processID = getProcessId().trim().toUpperCase();
currentProcess = getCurrentProcess().trim().toUpperCase(); currentProcess = getCurrentProcess().trim().toUpperCase();
statusDetail = getStatusDetail().trim().toUpperCase(); statusDetail = getStatusDetail().trim().toUpperCase();
*/
processID = getProcessId().trim();
if (getCurrentProcess() != null)
{
currentProcess = getCurrentProcess().trim();
}
else
{
currentProcess = processID;
}
statusDetail = getStatusDetail().trim();
// Modified on 16/09/2019 [Should not convert case and should write as is happening in PB].End
System.out.println("processID:::: " + processID + " currentProcess:::: " + currentProcess + " statusDetail:::: " + statusDetail); System.out.println("processID:::: " + processID + " currentProcess:::: " + currentProcess + " statusDetail:::: " + statusDetail);
if(!(processID.equalsIgnoreCase(currentProcess))) if(!(processID.equalsIgnoreCase(currentProcess)))
{ {
......
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