From f4fa4ff27e730cd44987940ee489ed30c529dac7 Mon Sep 17 00:00:00 2001 From: ebocher Date: Fri, 2 Feb 2024 15:44:59 +0100 Subject: [PATCH] Remove logback --- common-utils/pom.xml | 6 +++--- .../orbisgis/geoclimate/utils/LoggerUtils.groovy | 13 ++++--------- .../orbisgis/geoclimate/osmtools/OSMTools.groovy | 2 -- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/common-utils/pom.xml b/common-utils/pom.xml index 0805acc9df..3927c5828a 100644 --- a/common-utils/pom.xml +++ b/common-utils/pom.xml @@ -30,9 +30,9 @@ slf4j-api - ch.qos.logback - logback-classic - ${logback-version} + org.slf4j + slf4j-simple + ${slf4j-version} diff --git a/common-utils/src/main/groovy/org/orbisgis/geoclimate/utils/LoggerUtils.groovy b/common-utils/src/main/groovy/org/orbisgis/geoclimate/utils/LoggerUtils.groovy index aeb14a1bb3..167346048b 100644 --- a/common-utils/src/main/groovy/org/orbisgis/geoclimate/utils/LoggerUtils.groovy +++ b/common-utils/src/main/groovy/org/orbisgis/geoclimate/utils/LoggerUtils.groovy @@ -1,7 +1,5 @@ package org.orbisgis.geoclimate.utils -import ch.qos.logback.classic.Level -import ch.qos.logback.classic.LoggerContext import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -77,20 +75,17 @@ class LoggerUtils { */ static void setLoggerLevel(String loggerLevel) { if (loggerLevel) { - Level level if (loggerLevel.equalsIgnoreCase("INFO")) { - level = Level.INFO + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", loggerLevel.toLowerCase()) } else if (loggerLevel.equalsIgnoreCase("DEBUG")) { - level = Level.DEBUG + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", loggerLevel.toLowerCase()) } else if (loggerLevel.equalsIgnoreCase("TRACE")) { - level = Level.TRACE + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", loggerLevel.toLowerCase()) } else if (loggerLevel.equalsIgnoreCase("OFF")) { - level = Level.OFF + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", loggerLevel.toLowerCase()) } else { throw new RuntimeException("Invalid log level. Allowed values are : INFO, DEBUG, TRACE, OFF") } - var context = (LoggerContext) LoggerFactory.getILoggerFactory() - context.getLoggerList().each { it -> it.setLevel(level) } } } diff --git a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy index d9329ef1f5..d29497d1be 100644 --- a/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy +++ b/osmtools/src/main/groovy/org/orbisgis/geoclimate/osmtools/OSMTools.groovy @@ -23,8 +23,6 @@ package org.orbisgis.geoclimate.osmtools import org.orbisgis.geoclimate.osmtools.utils.TransformUtils import org.orbisgis.geoclimate.osmtools.utils.Utilities import org.orbisgis.geoclimate.utils.AbstractScript -import org.slf4j.Logger -import org.slf4j.LoggerFactory /** * Main script to access to all processes used to extract, transform and save OSM data as GIS layers.