切换日志到log4j2

This commit is contained in:
谷成伟 2024-12-27 11:11:28 +08:00
parent e2440a72b2
commit e0f7f3cc43
5 changed files with 28 additions and 8 deletions

View File

@ -44,9 +44,17 @@
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- 使用log4j2代替logback-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<!-- web 容器使用 undertow 代替 tomcat--> <!-- web 容器使用 undertow 代替 tomcat-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -58,8 +58,8 @@ public class TDEngineService {
config.setUsername(username); config.setUsername(username);
config.setPassword(password); config.setPassword(password);
config.setConnectionTestQuery("select server_status()"); config.setConnectionTestQuery("select server_status()");
config.setMinimumIdle(10); //minimum number of idle connection config.setMinimumIdle(30); //minimum number of idle connection
config.setMaximumPoolSize(20); //maximum number of connection in the pool config.setMaximumPoolSize(30); //maximum number of connection in the pool
config.setMaxLifetime(0); // maximum life time for each connection config.setMaxLifetime(0); // maximum life time for each connection
// config.setIdleTimeout(0); // max idle time for recycle idle connection // config.setIdleTimeout(0); // max idle time for recycle idle connection
log.info("=======>TDEngineUrl:" + config.getJdbcUrl()); log.info("=======>TDEngineUrl:" + config.getJdbcUrl());
@ -89,7 +89,7 @@ public class TDEngineService {
} }
sb.append(") TAGS (`deviceid` BIGINT);"); sb.append(") TAGS (`deviceid` BIGINT);");
try { try {
log.info(sb.toString()); log.debug(sb.toString());
pstmt.executeUpdate(sb.toString()); pstmt.executeUpdate(sb.toString());
} catch (Exception e) { } catch (Exception e) {
log.error("创建超级表失败", e); log.error("创建超级表失败", e);
@ -111,7 +111,7 @@ public class TDEngineService {
sb.append(dataType); sb.append(dataType);
sb.append(") TAGS (`deviceid` BIGINT);"); sb.append(") TAGS (`deviceid` BIGINT);");
try { try {
log.info(sb.toString()); log.debug(sb.toString());
pstmt.executeUpdate(sb.toString()); pstmt.executeUpdate(sb.toString());
} catch (Exception e) { } catch (Exception e) {
log.error("创建[计算量]超级表失败", e); log.error("创建[计算量]超级表失败", e);

View File

@ -94,7 +94,10 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
@PostConstruct @PostConstruct
public void init() { public void init() {
//初始化高性能队列 //初始化高性能队列
int cpu = Runtime.getRuntime().availableProcessors(); int cpu = Runtime.getRuntime().availableProcessors() / 2;
if (cpu < 2) {
cpu = 2;
}
int bufferSize = 1024 * 4; int bufferSize = 1024 * 4;
disruptor = new Disruptor<>(TerminalMessage::new, bufferSize, DaemonThreadFactory.INSTANCE, ProducerType.MULTI, new BlockingWaitStrategy()); disruptor = new Disruptor<>(TerminalMessage::new, bufferSize, DaemonThreadFactory.INSTANCE, ProducerType.MULTI, new BlockingWaitStrategy());
// //

View File

@ -96,11 +96,18 @@ calc:
task-name: task-name:
logging: logging:
file:
name: /das/logs/das.log
level: level:
com: com:
das: DEBUG das: INFO
tdengine: tdengine:
password: taosdata password: taosdata
url: jdbc:TAOS-RS://192.168.109.187:6041/das url: jdbc:TAOS-RS://192.168.109.187:6041/das
username: root username: root
minio:
url: http://192.168.109.187:9000
bucket: das
accessKey: das
secretKey: zaq12WSX

View File

@ -96,6 +96,8 @@ das:
key: b6967ee87b86d85a key: b6967ee87b86d85a
logging: logging:
file:
name: /das/logs/das.log
level: level:
root: ERROR root: ERROR
com: com: