[Policy-20] getConfig & Policy resolved blockers
[policy/engine.git] / LogParser / src / main / java / org / openecomp / xacml / parser / ParseLog.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * LogParser
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.xacml.parser;
22
23 import java.io.File;
24 import java.io.FileInputStream;
25 import java.io.FileReader;
26 import java.io.IOException;
27 import java.io.InputStream;
28 import java.io.LineNumberReader;
29 import java.io.RandomAccessFile;
30 import java.nio.charset.Charset;
31 import java.nio.file.Files;
32 import java.nio.file.Path;
33 import java.nio.file.Paths;
34 import java.sql.Connection;
35 import java.sql.DriverManager;
36 import java.sql.PreparedStatement;
37 import java.sql.SQLException;
38 import java.text.Format;
39 import java.text.ParseException;
40 import java.text.SimpleDateFormat;
41 import java.util.Date;
42 import java.util.Properties;
43 import java.util.regex.Matcher;
44 import java.util.regex.Pattern;
45 import java.util.stream.Stream;
46
47 import org.apache.log4j.Logger;
48 import org.openecomp.policy.common.im.AdministrativeStateException;
49 import org.openecomp.policy.common.im.IntegrityMonitor;
50 import org.openecomp.policy.common.im.StandbyStatusException;
51 import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
52 import org.openecomp.xacml.parser.LogEntryObject.LOGTYPE;
53
54 /**
55  * Parse log files and store the information in a H2 database.
56  * 
57  *
58  */
59 public class ParseLog {
60         
61         // only logging last line of each log file processed to the log4j log file defined by property - PARSERLOGPATH
62         private static final Logger log4jlogger = Logger.getLogger(ParseLog.class.getName());
63
64         // processing logging 
65         private static org.openecomp.policy.common.logging.flexlogger.Logger logger = FlexLogger.getLogger(ParseLog.class.getName());
66
67         private static String system;
68         private static int lastNumberRead = 0;
69         private static int debuglastNumberRead = 0;
70         private static int errorlastNumberRead = 0;
71         private static String type;
72         private static long startFileSize;
73         private static long debugStartFileSize;
74         private static long errorStartFileSize;
75         private static String systemLogFile;
76         private static String logFile;
77         private static String debuglogFile;
78         private static String errorlogFile;
79         private static String JDBC_URL;
80         private static String JDBC_USER;
81         private static String JDBC_PASSWORD = "";
82         private static String JDBC_DRIVER;
83         private static int maxLength = 255;   //Max length that is allowed in the DB table
84         private static String resourceName;
85         private static long sleepTimer = 50000;
86         static  IntegrityMonitor im;
87         private static boolean isMissingLogFile;
88
89         private static RandomAccessFile randomAccessFile;
90         
91         public static void main(String[] args) throws Exception {
92
93                 Properties logProperties = getPropertiesValue("parserlog.properties");
94                 
95                 if(logProperties == null || isMissingLogFile){
96                         // missing the path of log file in the properties file, so stop the process
97                         logger.error("logProperties is null or LOGPATH is missing in parserlog.properties, so stop the process.");
98                         return;
99                 }
100      
101                 File fileLog = new File(systemLogFile);
102
103                 im = IntegrityMonitor.getInstance(resourceName,logProperties );
104                 
105                 startDebugLogParser(fileLog);
106                 startErrorLogParser(fileLog);
107                 startAPIRestLogParser(fileLog); 
108         
109         }       
110         
111         private static void startDebugLogParser(File fileLog) throws Exception{
112                 if(debuglogFile != null && !debuglogFile.isEmpty()){
113                         
114                         // pull the last line number 
115                         String dataFileName = "debug.log";
116                         String filesRead = PullLastLineRead(fileLog, dataFileName);  
117                         if (filesRead!= null){                  
118                                 filesRead = filesRead.replaceAll("(\\r\\n|\\n)", "<br />");
119                                 debuglastNumberRead= Integer.parseInt(filesRead.trim());
120                         }else{
121                                 debuglastNumberRead = 0;
122                         }       
123                         
124                         debugStartFileSize =  countLines(debuglogFile);
125                         if (debugStartFileSize < debuglastNumberRead ){ 
126                                 logger.error("Filed Rolled: set Last debug number read to 0");
127                                 debuglastNumberRead = 0;
128                         }
129                         
130                         isMissingLogFile = false; 
131                         Path debugfilePath = Paths.get(debuglogFile);
132                         File debugfile = new File(debuglogFile);
133                         debugStartFileSize = debugfile.length();
134                         // start process debug.log file
135
136                         Runnable  runnable = new Runnable (){
137                                 boolean isStop = false;
138                                 
139                                 public void run(){
140                                         while (!isStop){        
141                                      
142                                                 if (debugfile.isFile()){
143                                                         // log4jlogger must use .info
144                                                         try (Stream<String> lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + debuglastNumberRead)).skip(debuglastNumberRead)) {
145                                                                 
146                                                                 lines.forEachOrdered(line -> process(line, type, LOGTYPE.DEBUG));
147
148                                                         } catch (IOException e) {
149                                                                 logger.error("Error processing line in " + dataFileName + ":" + e);
150                                                                 logger.error("break the loop.");
151                                                                 isStop = true;
152                                                         }       
153                                                 }
154                                                 try {
155                                                         Thread.sleep(sleepTimer);
156                                                         debugStartFileSize =  countLines(debuglogFile);
157                                                 } catch (InterruptedException | IOException e) {
158                                                         logger.error("Error processing line in " + dataFileName + ":" + e);
159                                                         logger.error("break the loop.");
160                                                         isStop = true;
161                                                 }
162                                                 
163                                                 logger.debug("File Line Count of debug.log: " + debugStartFileSize + " value read in: " + debuglastNumberRead);
164                                                 if (debugStartFileSize < debuglastNumberRead ){
165                                                         logger.debug("Failed Rolled: set Last number read to 0");
166                                                         debuglastNumberRead = 0;
167                                                 }
168                                         }       
169                                 }
170                         };
171                         
172                         Thread thread = new Thread(runnable);
173                         thread.start();
174                         
175                 }       
176         }
177
178         private static void startErrorLogParser(File fileLog) throws Exception{
179                 
180                 if(errorlogFile != null && !errorlogFile.isEmpty()){
181                         
182                         // pull the last line number 
183                         String dataFileName = "error.log";
184                         String filesRead = PullLastLineRead(fileLog, dataFileName);  
185                         if (filesRead!= null){                  
186                                 filesRead = filesRead.replaceAll("(\\r\\n|\\n)", "<br />");
187                                 errorlastNumberRead= Integer.parseInt(filesRead.trim());
188                         }else{
189                                 errorlastNumberRead = 0;
190                         }       
191                         
192                         errorStartFileSize =  countLines(errorlogFile);
193                         if (errorStartFileSize < errorlastNumberRead ){
194                                 logger.error("Filed Rolled: set Last error number read to 0");
195                                 errorlastNumberRead = 0;
196                         }
197                         
198                         isMissingLogFile = false;                       
199                         Path errorfilePath = Paths.get(errorlogFile);
200                         File errorfile = new File(errorlogFile);
201                         errorStartFileSize = errorfile.length();
202                         // start process error.log file
203                         Runnable  runnable = new Runnable (){
204                                 boolean isStop = false;
205                                 public void run(){
206                     
207                                         while (!isStop){
208                                                 if (errorfile.isFile()){
209                                                         // log4jlogger must use .info
210                                                         try (Stream<String> lines = Files.lines(errorfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + errorlastNumberRead)).skip(errorlastNumberRead)) {
211                                                                 
212                                                                 lines.forEachOrdered(line -> process(line, type, LOGTYPE.ERROR));
213                                 
214                                                         } catch (IOException e) {
215                                                                 logger.error("Error processing line in " + dataFileName + ":" + e);
216                                                                 logger.error("break the loop.");
217                                                                 isStop = true;
218                                                         }       
219                                                 }
220                                                 try {
221                                                         Thread.sleep(sleepTimer);
222                                                         errorStartFileSize =  countLines(errorlogFile);
223                                                 } catch (InterruptedException | IOException e) {
224                                                         logger.error("Error processing line in " + dataFileName + ":" + e);
225                                                         logger.error("break the loop.");
226                                                         isStop = true;
227                                                 }
228                                                 
229                                                 logger.debug("File Line Count of error.log: " + errorStartFileSize + " value read in: " + errorlastNumberRead);
230                                                 if (errorStartFileSize < errorlastNumberRead ){
231                                                         logger.debug("Failed Rolled: set Last error number read to 0");
232                                                         errorlastNumberRead = 0;
233                                                 }
234                                         }       
235                                 }
236                         };
237                         
238                         Thread thread = new Thread(runnable);
239                         thread.start();
240                 }               
241         }
242         
243         private static void startAPIRestLogParser(File fileLog) throws Exception{
244                 
245                 if(logFile != null && !logFile.isEmpty()){
246                         
247                         // pull the last line number 
248                         String dataFileName = type.toLowerCase()+"-rest.log";
249                         String filesRead = PullLastLineRead(fileLog, dataFileName);  
250                         if (filesRead!= null){                  
251                                 filesRead = filesRead.replaceAll("(\\r\\n|\\n)", "<br />");
252                                 lastNumberRead= Integer.parseInt(filesRead.trim());
253                         }else{
254                                 lastNumberRead = 0;
255                         }                       
256                         startFileSize =  countLines(logFile);
257                         if (startFileSize < lastNumberRead ){
258                                 logger.error("Filed Rolled: set Last number read to 0");
259                                 lastNumberRead = 0;
260                         }
261                         
262                         isMissingLogFile = false;
263                 Path filePath = Paths.get(logFile);
264                 File file = new File(logFile);          
265                         startFileSize = file.length();
266                         // start process pap/pdp-rest.log file
267                         Runnable  runnable = new Runnable () {
268                                 boolean isStop = false;
269                                 public void run(){
270                                         while (!isStop){                
271                                                 
272                                                 if (file.isFile()){
273                                                         // log4jlogger must use .info
274                                                         try (Stream<String> lines = Files.lines(filePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + lastNumberRead)).skip(lastNumberRead)) {
275                                                                 
276                                                                 lines.forEachOrdered(line -> process(line, type, LOGTYPE.INFO));
277                                 
278                                                         } catch (IOException e) {
279                                                                 logger.error("Error processing line in " + dataFileName + ":" + e);
280                                                                 logger.error("break the loop.");
281                                                                 isStop = true;
282                                                         }       
283                                                 }
284                                                 try {
285                                                         Thread.sleep(sleepTimer);
286                                                         startFileSize =  countLines(logFile);
287                                                 } catch (InterruptedException | IOException e) {
288                                                         logger.error("Error processing line in " + dataFileName + ":" + e);
289                                                         logger.error("break the loop.");
290                                                         isStop = true;
291                                                 }
292                                                 
293                                                 logger.debug("File Line Count of " + dataFileName+": " + startFileSize + " value read in: " + lastNumberRead);
294                                                 if (startFileSize < lastNumberRead ){
295                                                         logger.debug("Failed Rolled: set Last number read to 0");
296                                                         lastNumberRead = 0;
297                                                 }
298                                         }       
299                                 }
300                         };
301                                 
302                         Thread thread = new Thread(runnable);
303                         thread.start();
304                 }               
305         }
306         
307         public static int countLines(String filename) throws IOException {
308             LineNumberReader reader  = new LineNumberReader(new FileReader(filename));
309             int cnt = 0;
310             String line= null;
311             while ((line = reader.readLine()) != null) {
312                 logger.info("Reading the Logs"+line);
313             }
314             cnt = reader.getLineNumber(); 
315             reader.close();
316             return cnt;
317         }       
318         
319         public static String PullLastLineRead(File file, String dataFileName) throws IOException {
320                 if(!file.exists()){
321                         file.createNewFile();
322                         return null;
323                 }
324                 randomAccessFile = new RandomAccessFile(file, "r");
325         StringBuilder builder = new StringBuilder();
326         long length = file.length();
327         logger.debug("dataFileName: " +dataFileName);
328         if(length > 0){
329                 length--;               
330                 randomAccessFile.seek(length);
331                 for(long seek = length; seek >= 0; --seek){
332                     randomAccessFile.seek(seek);
333                     char c = (char)randomAccessFile.read();
334                     builder.append(c);
335                     if(c == '\n'){
336                         builder = builder.reverse();
337                         logger.debug("builder.toString(): " +builder.toString());
338                         if (builder.toString().contains("Last-"+dataFileName+"-line-Read:")){
339                                 String[] parseString = builder.toString().split("Last-"+dataFileName+"-line-Read:");
340                                 String returnValue = parseString[1].replace("\r", "");
341                                 return returnValue.trim();
342                         }
343                         builder = null;
344                         builder = new StringBuilder();
345                      }  
346                 }
347         }
348         
349                 return null;
350         }
351
352         public static LogEntryObject pullOutLogValues(String line, String type){
353                 Date date;
354                 LogEntryObject logEntry = new LogEntryObject();
355                 String description = "";
356                 logEntry.setSystemType(type);
357                 logEntry.setSystem(system);
358                 logger.debug("In pullOutLogValues ...");
359                 //Values for PDP/PAP debug.log file contains "INFO:", error.log file contains ""ERROR:", others are in PDP/PAP rest log file
360                 if(line.contains("||INFO||") || line.contains("||ERROR||") || line.contains("INFO:") || line.contains("ERROR:")){
361                         String[] splitString = null;
362                         if(line.contains("||INFO||") || line.contains("||ERROR||")){
363                                 splitString = line.split("[||]");
364                         }else if(line.contains("INFO:")){
365                                 splitString = line.split("INFO:");
366                         }else{
367                                 splitString = line.split("ERROR:");
368                         }
369                         String dateString = splitString[0].substring(0, 19);
370                         logEntry.setDescription(splitString[splitString.length-1]);     
371
372                         //parse out date
373                         date = parseDate(dateString.replace("T", " "), "yyyy-MM-dd HH:mm:ss", false);
374                         logEntry.setDate(date);
375                         
376                         logEntry.setRemote(parseRemoteSystem(line));
377                         if (line.contains("INFO:") || line.contains("||INFO||")){
378                                 logEntry.setLogType(LOGTYPE.INFO);
379                         }else{
380                                 logEntry.setLogType(LOGTYPE.ERROR);
381                         }
382            // from PDP/PAP rest log file below
383                 }else if (line.contains("INFO") && line.contains(")-")){ 
384                         //parse out description
385                         logEntry.setDescription(line.substring(line.indexOf(")-")+3));
386
387                         date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
388                         logEntry.setDate(date);
389         
390                         logEntry.setRemote(parseRemoteSystem(line));
391                         logEntry.setLogType(LOGTYPE.INFO);
392                 } else if (line.contains("INFO") && line.contains("--- [")){
393                         //parse out description
394                         String temp = line.substring(line.indexOf("---")+1);
395                         String[] split = temp.split(":");
396
397                         logEntry.setDescription(split[1]);
398
399                         //parse out date
400                         date = parseDate(line, "yyyy-MM-dd HH:mm:ss", false);
401                         logEntry.setDate(date);
402                         
403                         //remote system
404                         logEntry.setRemote(parseRemoteSystem(line));
405                         logEntry.setLogType(LOGTYPE.INFO);
406                 }else if (line.contains("SEVERE") && line.contains("[main]")){                  
407                         String[] splitString = line.split(" ");
408                         
409                         for (int i = 5; i < splitString.length; i++){
410                                 description = description +  " " + splitString[i];
411                         }
412
413                         logEntry.setDescription(description);
414                         //parse out date
415                         date = parseDate(line, "dd-MMM-yyyy HH:mm:ss", false);
416                         logEntry.setDate(date);
417                         logEntry.setLogType(LOGTYPE.SEVERE);
418                 } else if (line.contains("WARN") && line.contains(")-")){
419                         //parse out description
420
421                         logEntry.setDescription(line.substring(line.indexOf(")-")+3));
422
423                         //parse out date
424                         date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
425                         logEntry.setDate(date);
426                         
427                         //remote system
428                         logEntry.setRemote(parseRemoteSystem(line));
429                         logEntry.setLogType(LOGTYPE.WARN);
430                 }else if (line.contains("WARNING") && type =="PyPDP"){
431                         String[] splitString = line.split(" ");
432                         for (int i = 5; i < splitString.length; i++){
433                                 description = description +  " " + splitString[i];
434                         }
435
436                         //parse out date
437                         date = parseDate(line, "dd-MMM-yyyy HH:mm:ss", false);
438                         logEntry.setDate(date);
439                         logEntry.setLogType(LOGTYPE.WARN);
440                 }else if (line.contains("ERROR") && line.contains(")-")){
441                         //parse out description
442                         description = line.substring(line.indexOf(")-")+3);
443
444                         //parse out date
445                         date = parseDate(line, "yy_MM_dd_HH_mm_ss", true);
446                         logEntry.setDate(date);
447                         //remote system
448                         logEntry.setRemote(parseRemoteSystem(line));
449                         logEntry.setLogType(LOGTYPE.ERROR);
450                 }else {
451                         return null;
452                 }               
453
454                 return logEntry;
455         }
456
457         private static void DBClose(Connection conn) {
458                 try {
459                         conn.close();
460                 } catch (SQLException e) {
461                         logger.error("Error closing DB Connection: " + e);
462                         
463                 }
464         }
465
466         public static void process(String line, String type, LOGTYPE logFile)  {
467                 
468                 logger.debug("In process: processing line : " + line);
469                 LogEntryObject returnLogValue = null;
470                 if (im!=null){
471                         try {
472                                 im.startTransaction();
473                         } catch (AdministrativeStateException e) {
474                                 logger.error("Error received" + e);                             
475                         } catch (StandbyStatusException e) {
476                                 logger.error("Error received" + e);
477                         }
478                 }
479                 returnLogValue = pullOutLogValues(line, type);
480                 
481                 if(logFile.equals(LOGTYPE.DEBUG)){
482                    debuglastNumberRead++;
483                 }else if(logFile.equals(LOGTYPE.ERROR)){
484                    errorlastNumberRead++;
485                 }else if(logFile.equals(LOGTYPE.INFO)){
486                    lastNumberRead++;
487                 }
488                 if (returnLogValue!=null){
489                         writeDB(returnLogValue);
490                 }
491                 if (im!=null){
492                         im.endTransaction();
493                 }
494         }
495         
496         private static void writeDB(LogEntryObject returnLogValue) {
497
498                 Connection conn = DBConnection(JDBC_DRIVER, JDBC_URL, JDBC_USER,JDBC_PASSWORD);
499                 DBAccesss(conn, returnLogValue.getSystem(), returnLogValue.getDescription(),  
500                                                 returnLogValue.getDate(), returnLogValue.getRemote(), 
501                                                 returnLogValue.getSystemType(), returnLogValue.getLogType().toString());
502                 DBClose(conn);  
503         }
504
505         private static Connection DBConnection(String driver, String jdbc, String user, String pass){
506         
507         try {
508                 Class.forName(driver);
509                         Connection conn = DriverManager.getConnection(jdbc, user, pass);
510                         return conn;
511                 } catch ( Exception e) {
512                         logger.error("Error connecting to DB: " + e);
513                 }
514                 return null;
515         }
516         private static void DBAccesss(Connection conn, String system, String description, Date date, String remote, String type, String logType)  {
517                 
518                 String sdate = null;
519                 
520                 if (date!=null){
521                         Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
522                         sdate = formatter.format(date); 
523                         logger.debug("DBAccesss : sdate : " + sdate);
524                 }else{
525                         logger.debug("DBAccesss : sdate is null");
526                 }
527                 
528                 //ensure the length of description is less than the maximumm db char length
529                 if (description.length() > maxLength) {
530                         description = description.substring(0, maxLength);
531                 }
532                 
533                 try {
534                         PreparedStatement prep = conn.prepareStatement("insert into SYSTEMLOGDB values (NULL, ?, ?, ?,  ?,  ?, ?);");
535                         prep.setString(1, system);
536                         prep.setString(2, description);
537                         prep.setString(3, remote);
538                         prep.setString(4, type);
539                         prep.setString(5, sdate);
540                         prep.setString(6, logType);
541
542                         prep.executeUpdate();
543                         prep.close();
544
545                 } catch (SQLException e1) {
546                         logger.error("Error trying to excute SQL Statment: " + e1);
547                 }
548         }
549
550         public static Date parseDate(String dateline, String pattern, boolean singleSplit)  {
551                 
552                 Date returnDate;
553                 String[] splitString = dateline.split(" ");
554                 SimpleDateFormat formatter = new SimpleDateFormat(pattern);     
555                 if (singleSplit){
556                         try {
557                                 returnDate = formatter.parse(splitString[0]);
558                         } catch (ParseException e) {
559                                 logger.error("Unable to parse date for line: " + dateline);
560                                 returnDate = null;
561                         }
562                 }else{
563                         String tmpString = splitString[0] + " " + splitString[1];
564                         try {
565                                 returnDate = formatter.parse(tmpString);
566                         } catch (ParseException e) {
567                                 logger.error("Unable to parse date for line: " + dateline);
568                                 returnDate = null;
569                         }
570                 }
571                         
572                 return returnDate; 
573         }
574
575         
576         public static String parseRemoteSystem(String line) {
577                 
578                 if (line.contains("http") && !(line.contains("www.w3.org"))){
579         
580                         Pattern pattern = Pattern.compile("://(.+?)/");
581                         Matcher remote = pattern.matcher(line);
582                         if (remote.find())
583                         {
584                                 return remote.group(1);
585                         } 
586                 }
587                 return null;
588         }
589         
590         public static String[] getPaths(String logPath){        
591                 
592                 if(logPath != null && !logPath.isEmpty()){
593                         if(logPath.contains(";")){
594                        return logPath.split(";");
595                         }else{
596                                  String[] oneFile = new String[1];
597                                  oneFile[0] = logPath;
598                                  return oneFile;
599                         }
600                 }
601                 
602             return null;        
603         }
604         
605         public static Properties getPropertiesValue(String fileName) {
606                 Properties config = new Properties();
607                 Path file = Paths.get(fileName);
608                 if (Files.notExists(file)) {
609                         logger.debug("File doesn't exist in the specified Path "        + file.toString());
610                 }else{ 
611                         if (file.toString().endsWith(".properties")) {
612                                 InputStream in;
613                                 try {
614                                         in = new FileInputStream(file.toFile());
615                                         config.load(in);
616                                                         
617                                         resourceName = config.getProperty("RESOURCE_NAME");
618                                         system = config.getProperty("SERVER");
619                                         type = config.getProperty("LOGTYPE");
620                                         systemLogFile = config.getProperty("PARSERLOGPATH");
621                                         String logFiles = config.getProperty("LOGPATH");
622                                         if(logFiles == null || logFiles.isEmpty()){
623                                                 isMissingLogFile = true;
624                                                 return null;
625                                         }
626                                         
627                                         String[] splitString = getPaths(logFiles);
628                                         
629                                         if(splitString != null){
630                         for(int i=0;  i < splitString.length; i++){
631                                 
632                                 if(splitString[i].contains("debug")){
633                                                         // get path of debug.log file
634                                                         debuglogFile = splitString[i];
635                                                         if(debuglogFile != null && !debuglogFile.isEmpty()){
636                                                                 debuglogFile = debuglogFile.trim();
637                                                         }
638                                 }else if(splitString[i].contains("error")){
639                                                         // get path of error.log file
640                                                         errorlogFile = splitString[i];
641                                                         if(errorlogFile != null && !errorlogFile.isEmpty()){
642                                                                 errorlogFile = errorlogFile.trim();
643                                                         }
644                                 }else {
645                                                         // get path of default file
646                                         logFile = splitString[i];
647                                                         if(logFile != null && !logFile.isEmpty()){
648                                                                 logFile = logFile.trim();
649                                                         }
650                                 }
651                         }
652                                         }else{  
653                                                 
654                                                 debuglogFile = null;
655                                                 errorlogFile = null;
656                                                 logFile = null;
657                                         }
658                                         
659                                         JDBC_URL = config.getProperty("JDBC_URL").replace("'", "");
660                                         JDBC_USER = config.getProperty("JDBC_USER");
661                                         JDBC_DRIVER =  config.getProperty("JDBC_DRIVER");
662                                         JDBC_PASSWORD = config.getProperty("JDBC_PASSWORD");
663                                         return config;
664
665                                 } catch (IOException e) {                                       
666                                         logger.debug("Error porcessing Config file will be unable to create Health Check" + e);
667                                 }
668                                 
669                         }
670                 }
671                 return null;
672         }       
673 }