Fixed log configuration.

This commit is contained in:
Christian P. MOMON 2020-01-23 09:07:38 +01:00
parent 7a7704fc12
commit a7d1f43f28
2 changed files with 11 additions and 6 deletions

View file

@ -21,6 +21,7 @@ package org.april.agirstatool;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.PropertyConfigurator;
import org.april.agirstatool.cli.AgiStatoolCLI;
import org.april.agirstatool.demo.AgirStatool;
@ -59,7 +60,7 @@ public final class AgirStatoolLauncher
}
else
{
// BasicConfigurator.configure();
BasicConfigurator.configure();
// logger.info("Basic log configuration done.");
// logger.info("Configuration file was not found in [{}].",
// loggerConfig.getAbsoluteFile());

View file

@ -86,8 +86,9 @@ public final class AgiStatoolCLI
else
{
BasicConfigurator.configure();
logger.info("Basic log configuration done.");
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
// logger.info("Basic log configuration done.");
// logger.info("Configuration file was not found in [{}].",
// loggerConfig.getAbsoluteFile());
}
// Run.
@ -175,9 +176,12 @@ public final class AgiStatoolCLI
{
// Apply -c parameter.
File log4jfile = new File(configurationFile.getParentFile(), "log4j.properties");
logger.info("Applying configuration file found in [{}].", log4jfile.getAbsoluteFile());
PropertyConfigurator.configure(log4jfile.getAbsolutePath());
logger.info("Configuration log configuration done.");
if (log4jfile.exists())
{
logger.info("Applying configuration file found in [{}].", log4jfile.getAbsoluteFile());
PropertyConfigurator.configure(log4jfile.getAbsolutePath());
logger.info("Configuration log configuration done.");
}
switch (command)
{