mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
StaticLog rename to LogUtil
This commit is contained in:
parent
d0556a4e48
commit
4670f21a8c
@ -62,7 +62,7 @@ import java.util.function.Supplier;
|
||||
* <li>去除两边的指定所有字符:trim</li>
|
||||
* <li>去除两边的指定所有字符包装和去除包装:wrap</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* 需要注意的是,strip、trim、wrap(unWrap)的策略不同:
|
||||
* <ul>
|
||||
* <li>strip: 强调去除两边或某一边的指定字符串,这个字符串不会重复去除,如果一边不存在,另一边不影响去除</li>
|
||||
@ -1538,12 +1538,22 @@ public class CharSequenceUtil extends StrValidator {
|
||||
|
||||
/**
|
||||
* 截取字符串,从指定位置开始,截取指定长度的字符串<br>
|
||||
* author weibaohui
|
||||
* 当fromIndex为正数时,这个index指的是插空位置,如下:
|
||||
* <pre>
|
||||
* 0 1 2 3 4
|
||||
* A B C D
|
||||
* </pre>
|
||||
* 当fromIndex为负数时,为反向插空位置,其中-1表示最后一个字符之前的位置:
|
||||
* <pre>
|
||||
* -3 -2 -1 length
|
||||
* A B C D
|
||||
* </pre>
|
||||
*
|
||||
* @param input 原始字符串
|
||||
* @param fromIndex 开始的index,包括
|
||||
* @param fromIndex 开始的index,包括,可以为负数
|
||||
* @param length 要截取的长度
|
||||
* @return 截取后的字符串
|
||||
* author weibaohui
|
||||
*/
|
||||
public static String subByLength(final String input, final int fromIndex, final int length) {
|
||||
if (isEmpty(input)) {
|
||||
|
32
hutool-core/src/test/java/org/dromara/hutool/core/text/IssueI73AB9Test.java
Executable file
32
hutool-core/src/test/java/org/dromara/hutool/core/text/IssueI73AB9Test.java
Executable file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2023 looly(loolly@aliyun.com)
|
||||
* Hutool is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.core.text;
|
||||
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class IssueI73AB9Test {
|
||||
|
||||
/**
|
||||
* https://gitee.com/dromara/hutool/issues/I73AB9
|
||||
*/
|
||||
@Test
|
||||
void subWithLengthTest() {
|
||||
final String str = "7814A103447E";
|
||||
String s = StrUtil.subByLength(str, -4, 2);
|
||||
Assertions.assertEquals("03", s);
|
||||
s = StrUtil.subByLength(str, -2, 2);
|
||||
Assertions.assertEquals("44", s);
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ import org.dromara.hutool.cron.pattern.CronPattern;
|
||||
import org.dromara.hutool.cron.task.InvokeTask;
|
||||
import org.dromara.hutool.cron.task.RunnableTask;
|
||||
import org.dromara.hutool.cron.task.Task;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
import org.dromara.hutool.setting.Setting;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -221,7 +221,7 @@ public class Scheduler implements Serializable {
|
||||
jobClass = group + CharUtil.DOT + jobClass;
|
||||
}
|
||||
final String pattern = entry.getValue();
|
||||
StaticLog.debug("Load job: {} {}", pattern, jobClass);
|
||||
LogUtil.debug("Load job: {} {}", pattern, jobClass);
|
||||
try {
|
||||
// issue#I5E7BM@Gitee,自定义ID避免重复从配置文件加载
|
||||
schedule("id_" + jobClass, pattern, new InvokeTask(jobClass));
|
||||
|
@ -13,7 +13,7 @@
|
||||
package org.dromara.hutool.cron.listener;
|
||||
|
||||
import org.dromara.hutool.cron.TaskExecutor;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@ -95,7 +95,7 @@ public class TaskListenerManager implements Serializable {
|
||||
listener.onFailed(executor, exception);
|
||||
}
|
||||
}else{
|
||||
StaticLog.error(exception, exception.getMessage());
|
||||
LogUtil.error(exception, exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
package org.dromara.hutool.cron.timingwheel;
|
||||
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@ -108,7 +108,7 @@ public class TimingWheel {
|
||||
//当前时间轮可以容纳该任务 加入时间槽
|
||||
final long virtualId = expiration / tickMs;
|
||||
final int index = (int) (virtualId % wheelSize);
|
||||
StaticLog.debug("tickMs: {} ------index: {} ------expiration: {}", tickMs, index, expiration);
|
||||
LogUtil.debug("tickMs: {} ------index: {} ------expiration: {}", tickMs, index, expiration);
|
||||
|
||||
final TimerTaskList timerTaskList = timerTaskLists[index];
|
||||
timerTaskList.addTask(timerTask);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import org.dromara.hutool.core.lang.Singleton;
|
||||
import org.dromara.hutool.core.spi.SpiUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.extra.pinyin.PinyinException;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* 简单拼音引擎工厂,用于根据用户引入的拼音库jar,自动创建对应的拼音引擎对象<br>
|
||||
@ -43,7 +43,7 @@ public class PinyinEngineFactory {
|
||||
*/
|
||||
public static PinyinEngine createEngine() {
|
||||
final PinyinEngine engine = doCreateEngine();
|
||||
StaticLog.debug("Use [{}] Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
LogUtil.debug("Use [{}] Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import org.dromara.hutool.core.spi.SpiUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.extra.template.TemplateConfig;
|
||||
import org.dromara.hutool.extra.template.TemplateException;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* 简单模板引擎工厂,用于根据用户引入的模板引擎jar,自动创建对应的模板引擎对象<br>
|
||||
@ -58,7 +58,7 @@ public class TemplateEngineFactory {
|
||||
*/
|
||||
public static TemplateEngine createEngine(final TemplateConfig config) {
|
||||
final TemplateEngine engine = doCreateEngine(config);
|
||||
StaticLog.debug("Use [{}] Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
LogUtil.debug("Use [{}] Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ import org.dromara.hutool.core.lang.Singleton;
|
||||
import org.dromara.hutool.core.spi.SpiUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.extra.tokenizer.TokenizerException;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* 简单分词引擎工厂,用于根据用户引入的分词引擎jar,自动创建对应的引擎
|
||||
@ -42,7 +42,7 @@ public class TokenizerEngineFactory {
|
||||
*/
|
||||
public static TokenizerEngine createEngine() {
|
||||
final TokenizerEngine engine = doCreateEngine();
|
||||
StaticLog.debug("Use [{}] Tokenizer Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
LogUtil.debug("Use [{}] Tokenizer Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ import org.dromara.hutool.core.spi.SpiUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.http.HttpException;
|
||||
import org.dromara.hutool.http.client.ClientConfig;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* Http客户端引擎工厂类
|
||||
@ -56,7 +56,7 @@ public class ClientEngineFactory {
|
||||
*/
|
||||
public static ClientEngine createEngine() {
|
||||
final ClientEngine engine = doCreateEngine();
|
||||
StaticLog.debug("Use [{}] Http Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
LogUtil.debug("Use [{}] Http Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ import org.dromara.hutool.log.level.Level;
|
||||
*
|
||||
* @author Looly
|
||||
*/
|
||||
public class StaticLog {
|
||||
private static final String FQCN = StaticLog.class.getName();
|
||||
public class LogUtil {
|
||||
private static final String FQCN = LogUtil.class.getName();
|
||||
|
||||
// ----------------------------------------------------------- Log method start
|
||||
// ------------------------ Trace
|
@ -6,29 +6,29 @@ import org.dromara.hutool.log.engine.console.ConsoleLogEngine;
|
||||
import org.dromara.hutool.log.engine.log4j2.Log4j2LogEngine;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class StaticLogTest {
|
||||
public class LogUtilTest {
|
||||
|
||||
@Test
|
||||
public void staticLog4j2Test() {
|
||||
LogEngineFactory.setDefaultEngine(Log4j2LogEngine.class);
|
||||
StaticLog.debug("This is static {} log", "debug");
|
||||
StaticLog.info("This is static {} log", "info");
|
||||
LogUtil.debug("This is static {} log", "debug");
|
||||
LogUtil.info("This is static {} log", "info");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
LogEngineFactory.setDefaultEngine(ConsoleLogEngine.class);
|
||||
StaticLog.debug("This is static {} log", "debug");
|
||||
StaticLog.info("This is static {} log", "info");
|
||||
LogUtil.debug("This is static {} log", "debug");
|
||||
LogUtil.info("This is static {} log", "info");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void colorTest(){
|
||||
LogEngineFactory.setDefaultEngine(ConsoleColorLogEngine.class);
|
||||
StaticLog.debug("This is static {} log", "debug");
|
||||
StaticLog.info("This is static {} log", "info");
|
||||
StaticLog.error("This is static {} log", "error");
|
||||
StaticLog.warn("This is static {} log", "warn");
|
||||
StaticLog.trace("This is static {} log", "trace");
|
||||
LogUtil.debug("This is static {} log", "debug");
|
||||
LogUtil.info("This is static {} log", "info");
|
||||
LogUtil.error("This is static {} log", "error");
|
||||
LogUtil.warn("This is static {} log", "warn");
|
||||
LogUtil.trace("This is static {} log", "trace");
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ import org.dromara.hutool.core.func.SerSupplier;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.text.CharUtil;
|
||||
import org.dromara.hutool.core.util.CharsetUtil;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
import org.dromara.hutool.setting.props.Props;
|
||||
|
||||
import java.io.File;
|
||||
@ -232,7 +232,7 @@ public class Setting extends AbsSetting implements Map<String, String> {
|
||||
}
|
||||
});
|
||||
this.watchMonitor.start();
|
||||
StaticLog.debug("Auto load for [{}] listenning...", this.resource.getUrl());
|
||||
LogUtil.debug("Auto load for [{}] listenning...", this.resource.getUrl());
|
||||
} else {
|
||||
IoUtil.closeQuietly(this.watchMonitor);
|
||||
this.watchMonitor = null;
|
||||
@ -273,7 +273,7 @@ public class Setting extends AbsSetting implements Map<String, String> {
|
||||
public Object getObjByGroup(final CharSequence key, final CharSequence group, final Object defaultValue) {
|
||||
final String result = this.groupedMap.get(group, key);
|
||||
if (result == null && logIfNull) {
|
||||
StaticLog.debug("No key [{}] in group [{}] !", key, group);
|
||||
LogUtil.debug("No key [{}] in group [{}] !", key, group);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.core.util.CharsetUtil;
|
||||
import org.dromara.hutool.core.util.ObjUtil;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -360,7 +360,7 @@ public final class Props extends Properties implements TypeGetter<CharSequence>
|
||||
BeanUtil.setProperty(bean, StrUtil.subSuf(key, prefix.length()), entry.getValue());
|
||||
} catch (final Exception e) {
|
||||
// 忽略注入失败的字段(这些字段可能用于其它配置)
|
||||
StaticLog.debug("Ignore property: [{}],because of: {}", key, e);
|
||||
LogUtil.debug("Ignore property: [{}],because of: {}", key, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.AsynchronousSocketChannel;
|
||||
import java.nio.channels.CompletionHandler;
|
||||
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* 接入完成回调,单例使用
|
||||
@ -43,7 +43,7 @@ public class AcceptHandler implements CompletionHandler<AsynchronousSocketChanne
|
||||
|
||||
@Override
|
||||
public void failed(final Throwable exc, final AioServer aioServer) {
|
||||
StaticLog.error(exc);
|
||||
LogUtil.error(exc);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ package org.dromara.hutool.socket.aio;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
/**
|
||||
* 简易IO信息处理类<br>
|
||||
@ -31,6 +31,6 @@ public abstract class SimpleIoAction implements IoAction<ByteBuffer> {
|
||||
|
||||
@Override
|
||||
public void failed(final Throwable exc, final AioSession session) {
|
||||
StaticLog.error(exc);
|
||||
LogUtil.error(exc);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
package org.dromara.hutool.socket.nio;
|
||||
|
||||
import org.dromara.hutool.core.io.IORuntimeException;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.CompletionHandler;
|
||||
@ -33,7 +33,7 @@ public class AcceptHandler implements CompletionHandler<ServerSocketChannel, Nio
|
||||
try {
|
||||
// 获取连接到此服务器的客户端通道
|
||||
socketChannel = serverSocketChannel.accept();
|
||||
StaticLog.debug("Client [{}] accepted.", socketChannel.getRemoteAddress());
|
||||
LogUtil.debug("Client [{}] accepted.", socketChannel.getRemoteAddress());
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class AcceptHandler implements CompletionHandler<ServerSocketChannel, Nio
|
||||
|
||||
@Override
|
||||
public void failed(final Throwable exc, final NioServer nioServer) {
|
||||
StaticLog.error(exc);
|
||||
LogUtil.error(exc);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.dromara.hutool.core.date.DateUtil;
|
||||
import org.dromara.hutool.core.io.buffer.BufferUtil;
|
||||
import org.dromara.hutool.core.lang.Console;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.log.StaticLog;
|
||||
import org.dromara.hutool.log.LogUtil;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@ -17,7 +17,7 @@ public class AioServerTest {
|
||||
|
||||
@Override
|
||||
public void accept(final AioSession session) {
|
||||
StaticLog.debug("【客户端】:{} 连接。", session.getRemoteAddress());
|
||||
LogUtil.debug("【客户端】:{} 连接。", session.getRemoteAddress());
|
||||
session.write(BufferUtil.ofUtf8("=== Welcome to Hutool socket server. ==="));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user