From: Simon Brandhof Date: Mon, 14 Dec 2015 21:18:15 +0000 (+0100) Subject: Replace slf4j by SQ Logger in sonar-db X-Git-Tag: 5.4-M2~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c5794e1e2faa062a97df6663fdd4918382e6b0c6;p=sonarqube.git Replace slf4j by SQ Logger in sonar-db --- diff --git a/sonar-db/src/main/java/org/sonar/db/DatabaseUtils.java b/sonar-db/src/main/java/org/sonar/db/DatabaseUtils.java index 13227b1781d..3bb4b30c203 100644 --- a/sonar-db/src/main/java/org/sonar/db/DatabaseUtils.java +++ b/sonar-db/src/main/java/org/sonar/db/DatabaseUtils.java @@ -33,8 +33,8 @@ import java.util.Date; import java.util.List; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.slf4j.LoggerFactory; import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; import static com.google.common.collect.Lists.newArrayList; @@ -47,7 +47,7 @@ public class DatabaseUtils { try { connection.close(); } catch (SQLException e) { - LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close connection", e); + Loggers.get(DatabaseUtils.class).warn("Fail to close connection", e); // ignore } } @@ -58,7 +58,7 @@ public class DatabaseUtils { try { stmt.close(); } catch (SQLException e) { - LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close statement", e); + Loggers.get(DatabaseUtils.class).warn("Fail to close statement", e); // ignore } } @@ -69,7 +69,7 @@ public class DatabaseUtils { try { rs.close(); } catch (SQLException e) { - LoggerFactory.getLogger(DatabaseUtils.class).warn("Fail to close result set", e); + Loggers.get(DatabaseUtils.class).warn("Fail to close result set", e); // ignore } } diff --git a/sonar-db/src/main/java/org/sonar/db/MyBatisConfBuilder.java b/sonar-db/src/main/java/org/sonar/db/MyBatisConfBuilder.java index d5cc18bd064..407c76587c4 100644 --- a/sonar-db/src/main/java/org/sonar/db/MyBatisConfBuilder.java +++ b/sonar-db/src/main/java/org/sonar/db/MyBatisConfBuilder.java @@ -19,7 +19,6 @@ */ package org.sonar.db; -import ch.qos.logback.classic.Level; import com.google.common.io.Closeables; import java.io.InputStream; import org.apache.ibatis.builder.xml.XMLMapperBuilder; @@ -27,7 +26,8 @@ import org.apache.ibatis.mapping.Environment; import org.apache.ibatis.session.Configuration; import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; import org.apache.ibatis.type.JdbcType; -import org.slf4j.LoggerFactory; +import org.sonar.api.utils.log.LoggerLevel; +import org.sonar.api.utils.log.Loggers; import org.sonar.db.dialect.Dialect; import static com.google.common.base.Preconditions.checkArgument; @@ -93,7 +93,7 @@ public final class MyBatisConfBuilder { private void loadAndConfigureLogger(String mapperName) { conf.addLoadedResource(mapperName); - ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(mapperName)).setLevel(Level.INFO); + Loggers.get(mapperName).setLevel(LoggerLevel.INFO); } public void loadMappers(Class... mapperClasses) { diff --git a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java index dc645cfd0e6..46703af6093 100644 --- a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java +++ b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java @@ -29,9 +29,9 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.ibatis.session.ResultContext; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.SqlSession; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.api.utils.System2; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; import org.sonar.db.Dao; import org.sonar.db.DbSession; import org.sonar.db.MyBatis; @@ -44,7 +44,7 @@ import static org.sonar.api.utils.DateUtils.dateToLong; * @since 2.14 */ public class PurgeDao implements Dao { - private static final Logger LOG = LoggerFactory.getLogger(PurgeDao.class); + private static final Logger LOG = Loggers.get(PurgeDao.class); private final MyBatis mybatis; private final ResourceDao resourceDao; private final System2 system2;