From ea534f1cc7ac0adab8f1d76a6e9046a634d577f4 Mon Sep 17 00:00:00 2001 From: NSSuresh11 Date: Fri, 17 Mar 2017 16:33:43 +0530 Subject: [PATCH] OLE-9141 : Added LOG.info statements --- .../java/org/kuali/ole/spring/batch/BatchUtil.java | 6 +++++- .../spring/batch/processor/BatchBibFileProcessor.java | 1 + .../ole/spring/batch/processor/BatchFileProcessor.java | 7 +++++++ .../batch/rest/controller/BatchRestController.java | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/BatchUtil.java b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/BatchUtil.java index bbd39f5de8..4a04f6390a 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/BatchUtil.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/BatchUtil.java @@ -6,6 +6,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.log4j.Logger; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; @@ -46,6 +47,8 @@ public class BatchUtil extends OleNgUtil { private MarcRecordUtil marcRecordUtil; public static Map BATCH_JOB_EXECUTION_DETAILS_MAP = new HashMap<>(); private MarcXMLConverter marcXMLConverter; + private static final Logger LOG = Logger + .getLogger(BatchUtil.class); public OleDsNgRestClient getOleDsNgRestClient() { if(null == oleDsNgRestClient) { @@ -463,6 +466,7 @@ public String getStatusContent(String status, String totalTimeTaken) { } public BatchJobDetails createBatchJobDetailsEntry(BatchProcessJob batchProcessJob, String fileName) { + LOG.info("Inside createBatchJobDetailsEntry"); BatchJobDetails batchJobDetails = new BatchJobDetails(); batchJobDetails.setJobId(batchProcessJob.getJobId()); batchJobDetails.setJobName(batchProcessJob.getJobName()); @@ -503,7 +507,7 @@ public String getSolrDate(String dateStr, boolean isFrom) throws ParseException return solrDtFormat.format(cal.getTime()); } } catch (ParseException e) { - //LOG.error("Error while parsing user entered date::" + dateStr, e); + LOG.error("Error while parsing user entered date::" + dateStr, e); throw e; } } diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchBibFileProcessor.java b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchBibFileProcessor.java index e2f0931979..d93cb32af4 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchBibFileProcessor.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchBibFileProcessor.java @@ -43,6 +43,7 @@ public class BatchBibFileProcessor extends BatchFileProcessor { @Override public OleNgBatchResponse processRecords(Map recordsMap, BatchProcessTxObject batchProcessTxObject, BatchProcessProfile batchProcessProfile) throws JSONException { + LOG.info("Inside processRecords() in BatchBibFileProcessor >>>"); BatchJobDetails batchJobDetails = batchProcessTxObject.getBatchJobDetails(); String reportDirectoryName = batchProcessTxObject.getReportDirectoryName(); JSONArray jsonArray = new JSONArray(); diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchFileProcessor.java b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchFileProcessor.java index 8a35cdf200..5a5ff28273 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchFileProcessor.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/processor/BatchFileProcessor.java @@ -55,6 +55,7 @@ public abstract class BatchFileProcessor extends BatchUtil { public JSONObject processBatch(File inputFileDirectoryPath, String fileType, String profileId, String reportDirectoryName, BatchJobDetails batchJobDetails) throws Exception { + LOG.info("Inside Batch processBatch() in BatchFileProcessor >>>"); JSONObject response = new JSONObject(); BatchProcessProfile batchProcessProfile = new BatchProcessProfile(); @@ -62,14 +63,20 @@ public JSONObject processBatch(File inputFileDirectoryPath, String fileType, Str try { BATCH_JOB_EXECUTION_DETAILS_MAP.put(batchJobDetails.getJobId() + "_" + batchJobDetails.getJobDetailId(), batchJobDetails); batchProcessProfile = fetchBatchProcessProfile(profileId); + LOG.info("batchProcessProfile >>>>" + batchProcessProfile); BatchProcessTxObject batchProcessTxObject = new BatchProcessTxObject(); batchProcessTxObject.setBatchProcessProfile(batchProcessProfile); batchProcessTxObject.setBatchFileProcessor(this); batchProcessTxObject.setBatchJobDetails(batchJobDetails); + LOG.info("batchJobDetails >>>>" + batchJobDetails); batchProcessTxObject.setFileExtension(fileType); batchProcessTxObject.setReportDirectoryName(reportDirectoryName); batchProcessTxObject.getOleStopWatch().start(); batchProcessTxObject.setIncomingFileDirectoryPath(inputFileDirectoryPath.getAbsolutePath()); + LOG.info("ProfileID >>>>>>" + batchJobDetails.getProfileId()); + LOG.info("ProfileName >>>>>>" +batchJobDetails.getProfileName()); + LOG.info("FileName >>>>>>>" + batchJobDetails.getFileName()); + if (fileType.equalsIgnoreCase(OleNGConstants.MARC)) { OleCamelContext oleCamelContext = OleCamelContext.getInstance(); diff --git a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java index 3f3f939658..45028e131f 100644 --- a/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java +++ b/ole-app/olefs/src/main/java/org/kuali/ole/spring/batch/rest/controller/BatchRestController.java @@ -4,6 +4,7 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; @@ -69,6 +70,9 @@ public class BatchRestController extends OleNgControllerBase { @Autowired private DescribeDAO describeDAO; + private static final Logger LOG = Logger + .getLogger(BatchRestController.class); + public DescribeDAO getDescribeDAO() { return describeDAO; } @@ -109,6 +113,10 @@ public String UploadFile(@RequestParam("file") MultipartFile file, @RequestParam private JSONObject processBatch(File uploadDirectory, String batchType, String profileId, String fileExtension, BatchJobDetails batchJobDetails) throws Exception { BatchFileProcessor batchProcessor = getBatchProcessor(batchType); + LOG.info("batchJobDetails in processBatch() method >>>>" + batchJobDetails); + LOG.info("ProfileID >>>>>>" + batchJobDetails.getProfileId()); + LOG.info("ProfileName >>>>>>" +batchJobDetails.getProfileName()); + LOG.info("FileName >>>>>>>" + batchJobDetails.getFileName()); long jobDetailsId = batchJobDetails.getJobDetailId(); String reportDirectory = (jobDetailsId != 0) ? String.valueOf(jobDetailsId) : OleNGConstants.QUICK_LAUNCH + OleNGConstants.DATE_FORMAT.format(new Date()); @@ -177,7 +185,9 @@ public String createBatchJobDetailsEntry(@RequestBody String requestBody) { public String quickLaunchJob(@RequestParam("jobId") String jobId, @RequestParam("numOfRecordsInFile") String numOfRecordsInFile, @RequestParam("extension") String extension, @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) { BatchJobDetails batchJobDetails = null; try { + LOG.info("Starting QuickLauch Job"); BatchProcessJob matchedBatchJob = getBatchUtil().getBatchProcessJobById(Long.valueOf(jobId)); + LOG.info("matchedBatchJob job Id>>>" + matchedBatchJob.getJobId()); matchedBatchJob.setNumOfRecordsInFile(Integer.parseInt(numOfRecordsInFile)); matchedBatchJob.setOutputFileFormat(extension); String originalFilename = null;