// Path: agent-logging/src/main/java/fr/irit/smac/libs/tooling/logging/AgentLog.java
// public enum ESide {
//     LEFT, RIGHT
// }
// 
// Path: agent-logging/src/main/java/fr/irit/smac/libs/tooling/logging/logback/LoggerNameDiscriminator.java
// public class LoggerNameDiscriminator implements Discriminator<ILoggingEvent> {
// 
//     private boolean started = false;
// 
//     @Override
//     public boolean isStarted() {
//         return this.started;
//     }
// 
//     @Override
//     public void start() {
//         this.started = true;
//     }
// 
//     @Override
//     public void stop() {
//         this.started = false;
//     }
// 
//     @Override
//     public String getDiscriminatingValue(ILoggingEvent logEvent) {
//         return logEvent.getLoggerName().substring(AgentLog.ROOT_AGENT_LOGGER.length()+1);
//     }
// 
//     @Override
//     public String getKey() {
//         return "loggerName";
//     }
// 
// }


import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.sift.SiftingAppender;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.sift.AppenderFactory;
import fr.irit.smac.libs.tooling.logging.AgentLog.ILogItemDisplayData.ESide;
import fr.irit.smac.libs.tooling.logging.logback.LoggerNameDiscriminator;
     * properties can be used in this configuration file : - ${loggerName} -
     * ${logFolderName}
     * 
     * @param customLogbackConfigurationFile
     */
    private static void initialiseLogback(final String customLogbackConfigurationFile) {
        System.setProperty("logback.configurationFile", customLogbackConfigurationFile);
    }

    /**
     * the initialization method that configure the file appender
     * 
     * @param logFolderName
     * @param clearFolderContent
     * @param customLogbackConfigurationFile
     * @param logLevel
     * @param logTemplate
     */
    private static void initialiseLogback(
        final String logFolderName,
        final Level logLevel,
        final String logTemplate) {
        // get root logger and clear all existing appenders
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        ch.qos.logback.classic.Logger rootAgentLogger = (ch.qos.logback.classic.Logger) LoggerFactory
            .getLogger(AgentLog.ROOT_AGENT_LOGGER);
        rootAgentLogger.detachAndStopAllAppenders();

        // Configure and create a sifting encoder

// Path: agent-logging/src/main/java/fr/irit/smac/libs/tooling/logging/AgentLog.java
// public enum ESide {
//     LEFT, RIGHT
// }
// 
// Path: agent-logging/src/main/java/fr/irit/smac/libs/tooling/logging/logback/LoggerNameDiscriminator.java
// public class LoggerNameDiscriminator implements Discriminator<ILoggingEvent> {
// 
//     private boolean started = false;
// 
//     @Override
//     public boolean isStarted() {
//         return this.started;
//     }
// 
//     @Override
//     public void start() {
//         this.started = true;
//     }
// 
//     @Override
//     public void stop() {
//         this.started = false;
//     }
// 
//     @Override
//     public String getDiscriminatingValue(ILoggingEvent logEvent) {
//         return logEvent.getLoggerName().substring(AgentLog.ROOT_AGENT_LOGGER.length()+1);
//     }
// 
//     @Override
//     public String getKey() {
//         return "loggerName";
//     }
// 
// }


// Path: agent-logging/src/main/java/fr/irit/smac/libs/tooling/logging/AgentLog.java
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.sift.SiftingAppender;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.sift.AppenderFactory;
import fr.irit.smac.libs.tooling.logging.AgentLog.ILogItemDisplayData.ESide;
import fr.irit.smac.libs.tooling.logging.logback.LoggerNameDiscriminator;

     * properties can be used in this configuration file : - ${loggerName} -
     * ${logFolderName}
     * 
     * @param customLogbackConfigurationFile
     */
    private static void initialiseLogback(final String customLogbackConfigurationFile) {
        System.setProperty("logback.configurationFile", customLogbackConfigurationFile);
    }

    /**
     * the initialization method that configure the file appender
     * 
     * @param logFolderName
     * @param clearFolderContent
     * @param customLogbackConfigurationFile
     * @param logLevel
     * @param logTemplate
     */
    private static void initialiseLogback(
        final String logFolderName,
        final Level logLevel,
        final String logTemplate) {
        // get root logger and clear all existing appenders
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        ch.qos.logback.classic.Logger rootAgentLogger = (ch.qos.logback.classic.Logger) LoggerFactory
            .getLogger(AgentLog.ROOT_AGENT_LOGGER);
        rootAgentLogger.detachAndStopAllAppenders();

        // Configure and create a sifting encoder

        LoggerNameDiscriminator loggerNameDiscriminator = new LoggerNameDiscriminator();