From a9128f1964d43842056ea72dc1f0a8f3702cc03c Mon Sep 17 00:00:00 2001 From: Jegadeesh Babu Date: Thu, 28 Feb 2019 19:08:15 +0530 Subject: Added logger Sonar fix Issue-ID: APPC-1513 Change-Id: Ie6a28085288457b8bf8fea5c6d21313e61532f7c Signed-off-by: Jegadeesh Babu --- .../onap/appc/simulator/client/main/ClientRunner.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'appc-client/client-simulator') diff --git a/appc-client/client-simulator/src/main/java/org/onap/appc/simulator/client/main/ClientRunner.java b/appc-client/client-simulator/src/main/java/org/onap/appc/simulator/client/main/ClientRunner.java index d08b451a5..16fb1872e 100644 --- a/appc-client/client-simulator/src/main/java/org/onap/appc/simulator/client/main/ClientRunner.java +++ b/appc-client/client-simulator/src/main/java/org/onap/appc/simulator/client/main/ClientRunner.java @@ -6,6 +6,8 @@ * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= + * Modifications Copyright (C) 2019 IBM + * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,6 +29,8 @@ import org.apache.commons.io.filefilter.WildcardFileFilter; import org.onap.appc.simulator.client.RequestHandler; import org.onap.appc.simulator.client.impl.JsonRequestHandler; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.*; import java.nio.file.Path; import java.nio.file.Paths; @@ -36,13 +40,13 @@ import java.util.List; import java.util.Properties; public class ClientRunner { - + private static final EELFLogger LOG = EELFManager.getInstance().getLogger(ClientRunner.class); public static void main(String ... args) throws Exception { String folder = args[0]; if (folder == null) { folder = System.getProperty("user.dir"); } - System.out.println("== THR#" +Thread.currentThread().getId()+ " Reading files under the folder : " + folder); + LOG.info("== THR#" +Thread.currentThread().getId()+ " Reading files under the folder : " + folder); String inputType = args[1]; if (inputType != null && !inputType.matches("JSON")) { @@ -56,12 +60,12 @@ public class ClientRunner { int filesNum = 0; for (File source: sources) { reqHandler.proceedFile(source, log); - System.out.println("== THR#" +Thread.currentThread().getId()+ " File <" + source.getName() + "> processed."); + LOG.info("== THR#" +Thread.currentThread().getId()+ " File <" + source.getName() + "> processed."); ++filesNum; } - System.out.println("DONE with " + filesNum + " files under the folder : " + folder); + LOG.info("DONE with " + filesNum + " files under the folder : " + folder); Thread.sleep(30); - System.out.println("Shutdown ..."); + LOG.info("Shutdown ..."); reqHandler.shutdown(Boolean.parseBoolean(properties.getProperty("client.force.shutdown"))); // System.exit(0); } @@ -79,7 +83,7 @@ public class ClientRunner { try { prop.load(conf); } catch (IOException e) { - e.printStackTrace(); + LOG.error("Error occured while reading the property file", e); } } else { try { -- cgit 1.2.3-korg