diff --git a/NGCC/resources/log4j2.properties b/NGCC/resources/log4j2.properties index f796a68..a751a36 100644 --- a/NGCC/resources/log4j2.properties +++ b/NGCC/resources/log4j2.properties @@ -18,7 +18,7 @@ appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - #Création des loggers -loggers = console, f, d +loggers = console, f, e, w, i, d logger.f.name = fatalLogger logger.f.level = fatal @@ -27,6 +27,27 @@ logger.f.appenderRefs = console logger.f.appenderRef.console.ref = STDOUT logger.f.appenderRef.file.ref = LOGFILE +logger.e.name = errorLogger +logger.e.level = error +logger.e.additivity = false +logger.e.appenderRefs = console +logger.e.appenderRef.console.ref = STDOUT +logger.e.appenderRef.file.ref = LOGFILE + +logger.w.name = warnLogger +logger.w.level = warn +logger.w.additivity = false +logger.w.appenderRefs = console +logger.w.appenderRef.console.ref = STDOUT +logger.w.appenderRef.file.ref = LOGFILE + +logger.i.name = infoLogger +logger.i.level = info +logger.i.additivity = false +logger.i.appenderRefs = console +logger.i.appenderRef.console.ref = STDOUT +logger.i.appenderRef.file.ref = LOGFILE + logger.d.name = debugLogger logger.d.level = debug logger.d.additivity = false @@ -36,7 +57,7 @@ logger.d.appenderRef.file.ref = LOGFILE logger.console.name = log4j -logger.console.level = fatal +logger.console.level = warn logger.console.additivity = false logger.console.appenderRefs = console logger.console.appenderRef.console.ref = STDOUT diff --git a/NGCC/src/Exec.java b/NGCC/src/Exec.java index b1aac91..8223bb1 100644 --- a/NGCC/src/Exec.java +++ b/NGCC/src/Exec.java @@ -41,7 +41,7 @@ public class Exec implements Callable { public static void main(String[] args) throws InterruptedException { // Système de subcommand semblable à celui de git permettant d'appeler les classes relatives - //String[] t = {"-r","-v1","-d","pdf"}; + //String[] t = {"-r","-v9","-d","pdf"}; CommandLine cmd = new CommandLine (new Exec()) .addSubcommand("-r", new Read(System.out)) // nom commande, objet commande .addSubcommand("-b", new Build(System.out)) diff --git a/NGCC/src/commands/Read.java b/NGCC/src/commands/Read.java index a5abf29..08aaa8c 100644 --- a/NGCC/src/commands/Read.java +++ b/NGCC/src/commands/Read.java @@ -72,17 +72,28 @@ public class Read implements Callable { @Override public Void call() throws Exception { + // Niveau de debug selon verbosite + if (vb_level >= 0 && vb_level <=2) { logger = LogManager.getFormatterLogger("fatalLogger"); } + else if (vb_level >= 3 && vb_level <=4) { + logger = LogManager.getFormatterLogger("errorLogger"); + } + else if (vb_level >= 5 && vb_level <=6) { + logger = LogManager.getFormatterLogger("warnLogger"); + } + else if (vb_level >= 7 && vb_level <=8) { + logger = LogManager.getFormatterLogger("infoLogger"); + } else { logger = LogManager.getFormatterLogger("debugLogger"); } + // Help genere de la commande if(help) { - logger.fatal("help command for -r used"); - logger.debug("debug"); + logger.info("Help for 'read' command executed"); CommandLine.usage(this.spec, System.out); } else { @@ -107,32 +118,30 @@ public class Read implements Callable { // System.out.println("\nCopies correction succeed !\n"); //*************************************************** - - logger.fatal("Read command executed"); - logger.debug("Reading begin"); - System.out.println("\nRead mode activated ...\n"); // Debug des paramètres à exploiter plus tard - System.out.println("Update : "+step +"\n"+ - "Verbose : "+vb_level +"\n"+ - "Directory : "+directory_name +"\n"+ - "Result : "+result_name +"\n"+ - "Source : "+source_path +"\n"); + + // Log des parametres + + logger.info("Read mode activated"); + logger.debug("Update : "+step); + logger.debug("Verbose : "+vb_level); + logger.debug("Directory : "+directory_name); + logger.debug("Result : "+result_name); + logger.debug("Source : "+source_path); -// ********VOIR EQUIPE******** + - Config config = new Config(source_path); //Initialise le fichier de configuration selon le path donné + Config config = new Config(source_path); //Initialise le fichier de configuration selon le chemin donné config.readConfig(); - GestionnaireCopies ocr = new GestionnaireCopies(directory_name); + GestionnaireCopies ocr = new GestionnaireCopies(directory_name); // Instantie l'ocr GenerateCSV csv = new GenerateCSV(ocr.createHashMapforCSV(),config.getParam().get("Code"), result_name); - //ocr.setConfig(config); //Configure l'OCR en fonction du fichier de configuration initialisé - csv.createFile(); //Génère le fichier csv à partir de la HMap retournée par l'OCR //Done !