From 8de5b59c23d9aafacb6ff0e4052e0c9f0930eeba Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Tue, 1 Mar 2016 16:26:57 +0100 Subject: [PATCH] Remove method and , now useless because log4j2 prints all logs in a file. --- src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java b/src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java index 3b55829..de248d2 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/utils/Log.java @@ -16,13 +16,8 @@ package eu.omp.irap.vespa.epntapclient.utils; -import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,22 +36,19 @@ public class Log { /** The logger for this class. */ private static final Logger logger = LogManager.getLogger(EpnTapMainApp.class); - /** The log file path used by `logInFile` and `clearLogFile`. */ - private static String logPath = Const.TMP_DIR + "/log"; - /** Constructor to hide the implicit public one. */ private Log() { } /** * Print the specified object in JSON format in a file on the temp directory. The default file - * name is "log.json" + * name is "object.json" * * @param obj the object to print in a file. * @return The path of the file. */ public static String printObject(Object obj) { - return printObject("log", obj); + return printObject("object", obj); } /** @@ -80,34 +72,4 @@ public class Log { return path; } - // TODO: Use log4j FileAppender instead - - /** - * Delete the content of the log file. - */ - public static void clearLogFile() { - try (PrintWriter writer = new PrintWriter(logPath)) { - writer.print(""); - } catch (FileNotFoundException e) { - logger.error("File " + logPath + " not found, can not clear it.", e); - } - } - - // TODO: Use log4j FileAppender instead - - /** - * Print a message in a log file (named "log"). - * - * @param text The text to log in the file - */ - public static void logInFile(Object text) { - - try { - Files.write(Paths.get(logPath), (text.toString() + "\n").getBytes(), - StandardOpenOption.APPEND); - } catch (IOException e) { - logger.error("Can not print in the file " + logPath, e); - } - } - } -- libgit2 0.21.2