Added log initialization.
This commit is contained in:
parent
e04451b630
commit
42b3851369
11
log4j.properties
Normal file
11
log4j.properties
Normal file
@ -0,0 +1,11 @@
|
||||
# Log information (priority setting : DEBUG < INFO < WARN < ERROR)
|
||||
# ################
|
||||
log4j.rootLogger = INFO, CONSOLE
|
||||
|
||||
log4j.logger.org.dclermonte.siba = DEBUG
|
||||
|
||||
|
||||
#--
|
||||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - SIBA [%-5p] %34.34c.%25M - %m%n
|
@ -19,8 +19,14 @@
|
||||
*/
|
||||
package org.dclermonte.siba;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.dclermonte.siba.cli.SibaCLI;
|
||||
import org.dclermonte.siba.gui.SibaGUI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Siba
|
||||
{
|
||||
@ -30,21 +36,33 @@ public class Siba
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(Siba.class);
|
||||
|
||||
public static void main(final String[] args)
|
||||
{
|
||||
// Configure log.
|
||||
File loggerConfig = new File("log4j.properties");
|
||||
if (loggerConfig.exists())
|
||||
{
|
||||
PropertyConfigurator.configure(loggerConfig.getAbsolutePath());
|
||||
logger.info("Dedicated log configuration done.");
|
||||
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
|
||||
}
|
||||
else
|
||||
{
|
||||
BasicConfigurator.configure();
|
||||
logger.info("Basic log configuration done.");
|
||||
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
|
||||
}
|
||||
|
||||
// Run.
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
||||
SibaGUI.run();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SibaCLI.run(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user