Completed log settings.
This commit is contained in:
parent
0475664083
commit
7437a8c03e
@ -1,39 +1,21 @@
|
|||||||
log4j.rootLogger = warn, stdout
|
|
||||||
|
|
||||||
log4j.logger.org.april.hebdobot = info
|
|
||||||
|
|
||||||
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.stdout.layout.ConversionPattern = %d %-5p %c - %m%n
|
|
||||||
#log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - Hebdobot [%-5p] %34.34c.%25M - %m%n
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Log information (priority setting : DEBUG < INFO < WARN < ERROR)
|
# Log information (priority setting : DEBUG < INFO < WARN < ERROR)
|
||||||
|
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
|
||||||
# ################
|
# ################
|
||||||
log4j.rootLogger = INFO, RSLisi-Writer, CONSOLE
|
|
||||||
|
|
||||||
log4j.logger.fr.devinsy.hico = DEBUG
|
log4j.rootLogger = INFO, stdout, LogWriter
|
||||||
log4j.logger.fr.devinsy.kiss4web = DEBUG
|
log4j.logger.org.april.hebdobot = DEBUG
|
||||||
log4j.logger.fr.devinsy.xidyn = INFO
|
|
||||||
log4j.logger.fr.devinsy.xidyn.Presenter = INFO
|
|
||||||
log4j.logger.fr.devinsy.xidyn.FilePresenter = DEBUG
|
|
||||||
log4j.logger.eu.republiquesociale = DEBUG
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--
|
|
||||||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - RSLisi [%-5p] %34.34c.%25M - %m%n
|
|
||||||
|
|
||||||
|
|
||||||
#--
|
#--
|
||||||
log4j.appender.RSLisi-Writer = org.apache.log4j.RollingFileAppender
|
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
|
||||||
log4j.appender.RSLisi-Writer.File = /services/RSLisi/rslisi.log
|
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
|
||||||
log4j.appender.RSLisi-Writer.MaxFileSize = 100000KB
|
log4j.appender.stdout.layout.ConversionPattern = %m%n
|
||||||
log4j.appender.RSLisi-Writer.MaxBackupIndex = 100
|
|
||||||
log4j.appender.RSLisi-Writer.layout = org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.RSLisi-Writer.layout.ConversionPattern = %d{ISO8601} - RSLisi [%-5p] %-50c.%30M - %m%n
|
|
||||||
|
|
||||||
|
|
||||||
|
#--
|
||||||
|
log4j.appender.LogWriter = org.apache.log4j.RollingFileAppender
|
||||||
|
log4j.appender.LogWriter.File = /srv/hebdobot/hebdobot.log
|
||||||
|
log4j.appender.LogWriter.MaxFileSize = 100000KB
|
||||||
|
log4j.appender.LogWriter.MaxBackupIndex = 5
|
||||||
|
log4j.appender.LogWriter.layout = org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.LogWriter.layout.ConversionPattern = %d{ISO8601} - HEBDOBOT [%-5p] %34.34c.%-25M - %m%n
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.april.hebdobot;
|
package org.april.hebdobot;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.log4j.BasicConfigurator;
|
|
||||||
import org.apache.log4j.PropertyConfigurator;
|
|
||||||
import org.april.hebdobot.cli.HebdobotCLI;
|
import org.april.hebdobot.cli.HebdobotCLI;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -49,21 +45,6 @@ public class HebdobotLauncher
|
|||||||
*/
|
*/
|
||||||
public static void main(final String[] args)
|
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
setDefaultException();
|
setDefaultException();
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ import org.apache.commons.cli.HelpFormatter;
|
|||||||
import org.apache.commons.cli.Options;
|
import org.apache.commons.cli.Options;
|
||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.log4j.BasicConfigurator;
|
||||||
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.april.hebdobot.HebdobotException;
|
import org.april.hebdobot.HebdobotException;
|
||||||
import org.april.hebdobot.model.Hebdobot;
|
import org.april.hebdobot.model.Hebdobot;
|
||||||
import org.april.hebdobot.model.UserAliases;
|
import org.april.hebdobot.model.UserAliases;
|
||||||
@ -79,6 +81,8 @@ public class HebdobotCLI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.out.println("--------------------------------START-------------------------------------------");
|
||||||
|
|
||||||
//
|
//
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
options.addOption("h", "help", false, "Help option");
|
options.addOption("h", "help", false, "Help option");
|
||||||
@ -89,7 +93,6 @@ public class HebdobotCLI
|
|||||||
|
|
||||||
if (commandLine.hasOption("h"))
|
if (commandLine.hasOption("h"))
|
||||||
{
|
{
|
||||||
logger.debug("Help requires.");
|
|
||||||
help();
|
help();
|
||||||
|
|
||||||
HelpFormatter formatter = new HelpFormatter();
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
@ -101,7 +104,7 @@ public class HebdobotCLI
|
|||||||
File configFile;
|
File configFile;
|
||||||
if (commandLine.hasOption("c"))
|
if (commandLine.hasOption("c"))
|
||||||
{
|
{
|
||||||
logger.debug("'-c' option detected with value [{}].", commandLine.getOptionValue("c"));
|
System.out.println(String.format("'-c' option detected with value [%s].", commandLine.getOptionValue("c")));
|
||||||
|
|
||||||
// Check configuration file.
|
// Check configuration file.
|
||||||
String value = commandLine.getOptionValue("c");
|
String value = commandLine.getOptionValue("c");
|
||||||
@ -116,7 +119,7 @@ public class HebdobotCLI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.debug("'-c' option NOT detected.");
|
System.out.println("'-c' option NOT detected.");
|
||||||
|
|
||||||
// Try to load default configuration file in current work
|
// Try to load default configuration file in current work
|
||||||
// directory.
|
// directory.
|
||||||
@ -126,38 +129,31 @@ public class HebdobotCLI
|
|||||||
|
|
||||||
if (configFile.exists())
|
if (configFile.exists())
|
||||||
{
|
{
|
||||||
/*
|
// Init log file.
|
||||||
//
|
File loggerConfigFile = new File(configFile.getParent(), "log4j.properties");
|
||||||
File loggerConfigFile = new File(configFile, "log4j.properties");
|
|
||||||
if (loggerConfigFile.exists())
|
if (loggerConfigFile.exists())
|
||||||
{
|
{
|
||||||
PropertyConfigurator.configure(loggerConfigFile.getAbsolutePath());
|
PropertyConfigurator.configure(loggerConfigFile.getAbsolutePath());
|
||||||
|
logger.info("--==============================INIT==========================================--");
|
||||||
logger.info("Dedicated log configuration done.");
|
logger.info("Dedicated log configuration done.");
|
||||||
logger.info("Configuration file was found in [{}].", loggerConfigFile.getAbsoluteFile());
|
logger.info("Configuration log file was found in [{}].", loggerConfigFile.getAbsoluteFile());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
|
logger.info("--==============================INIT==========================================--");
|
||||||
logger.info("Basic log configuration done.");
|
logger.info("Basic log configuration done.");
|
||||||
logger.info("Configuration file was not found in [{}].", loggerConfigFile.getAbsoluteFile());
|
logger.info("Configuration file was not found in [{}].", loggerConfigFile.getAbsoluteFile());
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Load configuration file.
|
// Load configuration file.
|
||||||
logger.info("Config file loading… ({}).", configFile.getAbsolutePath());
|
logger.info("Configuration file loading… ({}).", configFile.getAbsolutePath());
|
||||||
HebdobotConfigFile config = new HebdobotConfigFile(configFile);
|
HebdobotConfigFile config = new HebdobotConfigFile(configFile);
|
||||||
logger.info("Config file loaded.");
|
logger.info("Configuration file loaded.");
|
||||||
|
|
||||||
// Load user aliases file.
|
|
||||||
File aliasFile = new File(configFile.getParentFile(), DEFAULT_ALIAS_FILE);
|
|
||||||
logger.info("Aliases file loading… ({}).", aliasFile.getAbsolutePath());
|
|
||||||
UserAliases aliases = new UserAliases(aliasFile);
|
|
||||||
logger.info("Aliases file loaded (" + aliases.size() + " aliases).");
|
|
||||||
logger.info("Alias liste:\n" + aliases.toString());
|
|
||||||
|
|
||||||
if (config.isValid())
|
if (config.isValid())
|
||||||
{
|
{
|
||||||
logger.info("Bot configuring…");
|
//
|
||||||
|
|
||||||
File reviewDirectory;
|
File reviewDirectory;
|
||||||
if (config.getReviewDirectory() == null)
|
if (config.getReviewDirectory() == null)
|
||||||
{
|
{
|
||||||
@ -172,9 +168,18 @@ public class HebdobotCLI
|
|||||||
reviewDirectory = new File(configFile.getParentFile(), config.getReviewDirectory());
|
reviewDirectory = new File(configFile.getParentFile(), config.getReviewDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load user aliases file.
|
||||||
|
File aliasFile = new File(configFile.getParentFile(), DEFAULT_ALIAS_FILE);
|
||||||
|
logger.info("Aliases file loading… ({}).", aliasFile.getAbsolutePath());
|
||||||
|
UserAliases aliases = new UserAliases(aliasFile);
|
||||||
|
logger.info("Aliases file loaded (" + aliases.size() + " aliases).");
|
||||||
|
logger.info("Alias liste:\n" + aliases.toString());
|
||||||
|
|
||||||
Hebdobot bot = new Hebdobot(config.getIrcHost(), config.getIrcPort(), config.getIrcName(), config.getIrcChannel(),
|
Hebdobot bot = new Hebdobot(config.getIrcHost(), config.getIrcPort(), config.getIrcName(), config.getIrcChannel(),
|
||||||
configFile.getParentFile(), reviewDirectory, config.getReviewFileSuffix());
|
configFile.getParentFile(), reviewDirectory, config.getReviewFileSuffix());
|
||||||
|
|
||||||
|
//
|
||||||
|
logger.info("Bot configuring…");
|
||||||
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
|
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
|
||||||
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
|
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
|
||||||
bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret());
|
bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret());
|
||||||
|
Loading…
Reference in New Issue
Block a user