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

View File

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