StaticLog rename to LogUtil

This commit is contained in:
Looly
2023-05-15 20:03:12 +08:00
parent d0556a4e48
commit 4670f21a8c
22 changed files with 98 additions and 56 deletions

View File

@@ -17,7 +17,7 @@ import org.dromara.hutool.db.dialect.Dialect;
import org.dromara.hutool.db.dialect.DialectFactory;
import org.dromara.hutool.db.ds.DSUtil;
import org.dromara.hutool.db.transaction.TransactionLevel;
import org.dromara.hutool.log.StaticLog;
import org.dromara.hutool.log.LogUtil;
import javax.sql.DataSource;
import java.sql.Connection;
@@ -190,7 +190,7 @@ public class Db extends AbstractDb<Db> {
try {
conn.rollback();
} catch (final Exception e) {
StaticLog.error(e);
LogUtil.error(e);
}
}
}
@@ -206,7 +206,7 @@ public class Db extends AbstractDb<Db> {
try {
conn.setAutoCommit(autoCommit);
} catch (final Exception e) {
StaticLog.error(e);
LogUtil.error(e);
}
}
}

View File

@@ -24,7 +24,7 @@ import org.dromara.hutool.db.dialect.impl.PhoenixDialect;
import org.dromara.hutool.db.dialect.impl.PostgresqlDialect;
import org.dromara.hutool.db.dialect.impl.SqlServer2012Dialect;
import org.dromara.hutool.db.dialect.impl.Sqlite3Dialect;
import org.dromara.hutool.log.StaticLog;
import org.dromara.hutool.log.LogUtil;
import javax.sql.DataSource;
import java.sql.Connection;
@@ -51,7 +51,7 @@ public class DialectFactory implements DriverNamePool {
*/
public static Dialect newDialect(final String driverName) {
final Dialect dialect = internalNewDialect(driverName);
StaticLog.debug("Use Dialect: [{}].", dialect.getClass().getSimpleName());
LogUtil.debug("Use Dialect: [{}].", dialect.getClass().getSimpleName());
return dialect;
}

View File

@@ -16,7 +16,7 @@ import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.spi.ListServiceLoader;
import org.dromara.hutool.db.DbRuntimeException;
import org.dromara.hutool.db.GlobalDbConfig;
import org.dromara.hutool.log.StaticLog;
import org.dromara.hutool.log.LogUtil;
import org.dromara.hutool.setting.Setting;
import javax.naming.InitialContext;
@@ -42,7 +42,7 @@ public class DSUtil {
try {
return getJndiDS(jndiName);
} catch (final DbRuntimeException e) {
StaticLog.error(e.getCause(), "Find JNDI datasource error!");
LogUtil.error(e.getCause(), "Find JNDI datasource error!");
}
return null;
}
@@ -108,7 +108,7 @@ public class DSUtil {
*/
public static DSFactory createFactory(final Setting setting) {
final DSFactory dsFactory = _createFactory(setting);
StaticLog.debug("Use [{}] DataSource As Default.", dsFactory.getDataSourceName());
LogUtil.debug("Use [{}] DataSource As Default.", dsFactory.getDataSourceName());
return dsFactory;
}

View File

@@ -14,7 +14,7 @@ package org.dromara.hutool.db.ds;
import org.dromara.hutool.core.io.IoUtil;
import org.dromara.hutool.core.util.RuntimeUtil;
import org.dromara.hutool.log.StaticLog;
import org.dromara.hutool.log.LogUtil;
/**
* 全局单例数据源工厂<br>
@@ -36,7 +36,7 @@ public class GlobalDSFactory {
RuntimeUtil.addShutdownHook(()->{
if (null != factory) {
IoUtil.closeQuietly(factory);
StaticLog.debug("DataSource: [{}] closed.", factory.getDataSourceName());
LogUtil.debug("DataSource: [{}] closed.", factory.getDataSourceName());
factory = null;
}
});
@@ -83,7 +83,7 @@ public class GlobalDSFactory {
IoUtil.closeQuietly(factory);
}
StaticLog.debug("Custom use [{}] DataSource.", customDSFactory.getDataSourceName());
LogUtil.debug("Custom use [{}] DataSource.", customDSFactory.getDataSourceName());
factory = customDSFactory;
}
return factory;

View File

@@ -2,7 +2,7 @@ package org.dromara.hutool.db;
import org.dromara.hutool.db.handler.EntityListHandler;
import org.dromara.hutool.db.sql.Condition;
import org.dromara.hutool.log.StaticLog;
import org.dromara.hutool.log.LogUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -119,7 +119,7 @@ public class DbTest {
Condition.parse("age", "< 100")
);
for (final Entity entity : find) {
StaticLog.debug("{}", entity);
LogUtil.debug("{}", entity);
}
Assertions.assertEquals("unitTestUser", find.get(0).get("name"));
}