// Path: src/main/java/net/technolords/micro/log/LogManager.java
// public class LogManager {
//     private static final Logger LOGGER = LoggerFactory.getLogger(LogManager.class);
// 
//     /**
//      * Auxiliary method to (re)initialize the logging. This method is typically called from
//      * the PropertiesManager when a external log4j2 configuration is provided, while at the
//      * same time no CLI parameter was given.
//      *
//      * Setting the new config location is enough, as it will trigger a reconfigure
//      * automatically.
//      *
//      * @param pathToLogConfiguration
//      *  A path to the external log configuration file.
//      */
//     public static void initializeLogging(String pathToLogConfiguration) {
//         Path path = FileSystems.getDefault().getPath(pathToLogConfiguration);
//         LOGGER.trace("Path to log configuration: {} -> file exists: {}", pathToLogConfiguration, Files.exists(path));
//         LoggerContext loggerContext = LoggerContext.getContext(false);
//         loggerContext.setConfigLocation(path.toUri());
//     }
// 
//     /**
//      * Auxiliary method to change the log level.
//      *
//      * @param logLevel
//      *  The log level to set.
//      *
//      * @return
//      *  A ResponseContext containing the result of the command.
//      */
//     public static ResponseContext changeLogLevel(String logLevel) {
//         ResponseContext responseContext = new ResponseContext();
//         responseContext.setContentType(ResponseContext.PLAIN_TEXT_CONTENT_TYPE);
//         LoggerContext loggerContext = LoggerContext.getContext(false);
//         Configuration configuration = loggerContext.getConfiguration();
//         LoggerConfig rootLogger = configuration.getRootLogger();
//         if (rootLogger != null) {
//             switch (StandardLevel.getStandardLevel(Level.toLevel(logLevel, Level.INFO).intLevel())) {
//                 case ERROR:
//                     rootLogger.setLevel(Level.ERROR);
//                     responseContext.setResponse("Log level changed to ERROR");
//                     break;
//                 case WARN:
//                     rootLogger.setLevel(Level.WARN);
//                     responseContext.setResponse("Log level changed to WARN");
//                     break;
//                 case INFO:
//                     rootLogger.setLevel(Level.INFO);
//                     responseContext.setResponse("Log level changed to INFO");
//                     break;
//                 case DEBUG:
//                     rootLogger.setLevel(Level.DEBUG);
//                     responseContext.setResponse("Log level changed to DEBUG");
//                     break;
//                 case OFF:
//                     rootLogger.setLevel(Level.OFF);
//                     responseContext.setResponse("Logging switched off");
//                     break;
//                 default:
//                     responseContext.setResponse("Log level unchanged, unsupported level: " + logLevel);
//             }
//             loggerContext.updateLoggers();
//         } else {
//             responseContext.setResponse("Unable to change log level, no ROOT logger found...");
//             responseContext.setErrorCode(String.valueOf(HttpURLConnection.HTTP_INTERNAL_ERROR));
//         }
//         return responseContext;
//     }
// }


import static java.nio.file.StandardOpenOption.READ;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.technolords.micro.log.LogManager;
        }
        for (Object key : properties.keySet()) {
            LOGGER.debug("Property: {} -> value: {}", key, properties.get(key));
        }
        return properties;
    }

    /**
     * Auxiliary method to load the properties.
     *
     * @param pathToPropertiesFile
     *  The path to the properties file.
     *
     * @return
     *  The properties.
     */
    private static Properties loadProperties(String pathToPropertiesFile) {
        Properties properties = new Properties();
        try {
            if (pathToPropertiesFile == null) {
                return properties;
            }
            Path path = FileSystems.getDefault().getPath(pathToPropertiesFile);
            properties.load(Files.newInputStream(path, READ));
            if (properties.get(PROP_LOG_CONFIG) != null) {
                // Note that at this point, putting this property back as system property is pointless,
                // as the JVM is already started. When there is no CLI property defined proceed by
                // delegation towards the LogManager.
                if (System.getProperty(PROP_LOG_CONFIG) == null) {
                    LOGGER.trace("log4j not as system property, do invoke builder");
// Path: src/main/java/net/technolords/micro/log/LogManager.java
// public class LogManager {
//     private static final Logger LOGGER = LoggerFactory.getLogger(LogManager.class);
// 
//     /**
//      * Auxiliary method to (re)initialize the logging. This method is typically called from
//      * the PropertiesManager when a external log4j2 configuration is provided, while at the
//      * same time no CLI parameter was given.
//      *
//      * Setting the new config location is enough, as it will trigger a reconfigure
//      * automatically.
//      *
//      * @param pathToLogConfiguration
//      *  A path to the external log configuration file.
//      */
//     public static void initializeLogging(String pathToLogConfiguration) {
//         Path path = FileSystems.getDefault().getPath(pathToLogConfiguration);
//         LOGGER.trace("Path to log configuration: {} -> file exists: {}", pathToLogConfiguration, Files.exists(path));
//         LoggerContext loggerContext = LoggerContext.getContext(false);
//         loggerContext.setConfigLocation(path.toUri());
//     }
// 
//     /**
//      * Auxiliary method to change the log level.
//      *
//      * @param logLevel
//      *  The log level to set.
//      *
//      * @return
//      *  A ResponseContext containing the result of the command.
//      */
//     public static ResponseContext changeLogLevel(String logLevel) {
//         ResponseContext responseContext = new ResponseContext();
//         responseContext.setContentType(ResponseContext.PLAIN_TEXT_CONTENT_TYPE);
//         LoggerContext loggerContext = LoggerContext.getContext(false);
//         Configuration configuration = loggerContext.getConfiguration();
//         LoggerConfig rootLogger = configuration.getRootLogger();
//         if (rootLogger != null) {
//             switch (StandardLevel.getStandardLevel(Level.toLevel(logLevel, Level.INFO).intLevel())) {
//                 case ERROR:
//                     rootLogger.setLevel(Level.ERROR);
//                     responseContext.setResponse("Log level changed to ERROR");
//                     break;
//                 case WARN:
//                     rootLogger.setLevel(Level.WARN);
//                     responseContext.setResponse("Log level changed to WARN");
//                     break;
//                 case INFO:
//                     rootLogger.setLevel(Level.INFO);
//                     responseContext.setResponse("Log level changed to INFO");
//                     break;
//                 case DEBUG:
//                     rootLogger.setLevel(Level.DEBUG);
//                     responseContext.setResponse("Log level changed to DEBUG");
//                     break;
//                 case OFF:
//                     rootLogger.setLevel(Level.OFF);
//                     responseContext.setResponse("Logging switched off");
//                     break;
//                 default:
//                     responseContext.setResponse("Log level unchanged, unsupported level: " + logLevel);
//             }
//             loggerContext.updateLoggers();
//         } else {
//             responseContext.setResponse("Unable to change log level, no ROOT logger found...");
//             responseContext.setErrorCode(String.valueOf(HttpURLConnection.HTTP_INTERNAL_ERROR));
//         }
//         return responseContext;
//     }
// }


// Path: src/main/java/net/technolords/micro/config/PropertiesManager.java
import static java.nio.file.StandardOpenOption.READ;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.technolords.micro.log.LogManager;

        }
        for (Object key : properties.keySet()) {
            LOGGER.debug("Property: {} -> value: {}", key, properties.get(key));
        }
        return properties;
    }

    /**
     * Auxiliary method to load the properties.
     *
     * @param pathToPropertiesFile
     *  The path to the properties file.
     *
     * @return
     *  The properties.
     */
    private static Properties loadProperties(String pathToPropertiesFile) {
        Properties properties = new Properties();
        try {
            if (pathToPropertiesFile == null) {
                return properties;
            }
            Path path = FileSystems.getDefault().getPath(pathToPropertiesFile);
            properties.load(Files.newInputStream(path, READ));
            if (properties.get(PROP_LOG_CONFIG) != null) {
                // Note that at this point, putting this property back as system property is pointless,
                // as the JVM is already started. When there is no CLI property defined proceed by
                // delegation towards the LogManager.
                if (System.getProperty(PROP_LOG_CONFIG) == null) {
                    LOGGER.trace("log4j not as system property, do invoke builder");
                    LogManager.initializeLogging((String) properties.get(PROP_LOG_CONFIG));