Browse Source

rev:配置修改

master
刘先源 4 weeks ago
parent
commit
1a2eafe8f3
  1. 10
      acs2/nladmin-system/src/main/java/org/nl/modules/lucene/config/LuceneAppender.java
  2. 26
      acs2/nladmin-system/src/main/resources/config/application-dev.yml
  3. 6
      acs2/nladmin-system/src/main/resources/config/application-dev2.yml
  4. 15
      acs2/nladmin-system/src/main/resources/config/application-prod.yml

10
acs2/nladmin-system/src/main/java/org/nl/modules/lucene/config/LuceneAppender.java

@ -13,6 +13,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.ttl.TransmittableThreadLocal; import com.alibaba.ttl.TransmittableThreadLocal;
import lombok.SneakyThrows;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field; import org.apache.lucene.document.Field;
@ -69,13 +70,16 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
} }
@SneakyThrows
@Override @Override
protected void append(ILoggingEvent event) { protected void append(ILoggingEvent event) {
String message = event.getFormattedMessage(); String message = event.getFormattedMessage();
try {
String[] split = message.split("@"); String[] split = message.split("@");
LuceneLogDto luceneLogDto = JSONObject.parseObject(split[1], LuceneLogDto.class); LuceneLogDto luceneLogDto = JSONObject.parseObject(split[0], LuceneLogDto.class);
Document document = new Document(); Document document = new Document();
try { System.out.println("---lucene----");
//向document对象中添加域。 //向document对象中添加域。
Map<String, String> mdcPropertyMap = event.getMDCPropertyMap(); Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
String traceId = mdcPropertyMap.get("traceId"); String traceId = mdcPropertyMap.get("traceId");
@ -121,9 +125,11 @@ public class LuceneAppender extends AppenderBase<ILoggingEvent> {
indexWriter.addDocument(document); indexWriter.addDocument(document);
indexWriter.commit(); indexWriter.commit();
} catch (IOException e) { } catch (IOException e) {
indexWriter.commit();
e.printStackTrace(); e.printStackTrace();
} }
} catch (Exception e) { } catch (Exception e) {
return; return;
} }
} }

26
acs2/nladmin-system/src/main/resources/config/application-dev.yml

@ -6,9 +6,9 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:shangdianke_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:sh_kn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:password} password: ${DB_PWD:root}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5
# 最小连接数 # 最小连接数
@ -52,11 +52,25 @@ spring:
multi-statement-allow: true multi-statement-allow: true
redis: redis:
#数据库索引 #数据库索引
database: ${REDIS_DB:15} database: ${REDIS_DB:3}
host: ${REDIS_HOST:127.0.0.1} host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:} password: ${REDIS_PWD:}
mqtt:
active: true
username: root
password: 123456
cleanSession: true
url: 127.0.0.1
clientId: sdk_mqtt21
topics:
- KN/#
qoss:
- 2
timeout: 30
keepalive: 15
# 登录相关配置 # 登录相关配置
login: login:
# 登录缓存 # 登录缓存
@ -126,8 +140,11 @@ file:
avatarMaxSize: 5 avatarMaxSize: 5
logging: logging:
file: file:
path: C:\acs path: C:\logs\ACS
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
lucene:
index:
path: C:\acs2\lucene\index
# Sa-Token配置 # Sa-Token配置
sa-token: sa-token:
@ -148,4 +165,3 @@ sa-token:
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀 # token 前缀
token-prefix: Bearer token-prefix: Bearer

6
acs2/nladmin-system/src/main/resources/config/application-dev2.yml

@ -52,7 +52,7 @@ spring:
multi-statement-allow: true multi-statement-allow: true
redis: redis:
#数据库索引 #数据库索引
database: ${REDIS_DB:3} database: ${REDIS_DB:1}
host: ${REDIS_HOST:127.0.0.1} host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:} password: ${REDIS_PWD:}
@ -142,6 +142,9 @@ logging:
file: file:
path: C:\logs\ACS path: C:\logs\ACS
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
lucene:
index:
path: C:\acs\lucene\index
# Sa-Token配置 # Sa-Token配置
sa-token: sa-token:
@ -162,4 +165,3 @@ sa-token:
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀 # token 前缀
token-prefix: Bearer token-prefix: Bearer

15
acs2/nladmin-system/src/main/resources/config/application-prod.yml

@ -6,9 +6,9 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:sdk_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.60.222}:${DB_PORT:3306}/${DB_NAME:kn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:password} password: ${DB_PWD:123456}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5
# 最小连接数 # 最小连接数
@ -52,7 +52,7 @@ spring:
multi-statement-allow: true multi-statement-allow: true
redis: redis:
#数据库索引 #数据库索引
database: ${REDIS_DB:3} database: ${REDIS_DB:1}
host: ${REDIS_HOST:127.0.0.1} host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:} password: ${REDIS_PWD:}
@ -61,11 +61,11 @@ spring:
active: true active: true
username: root username: root
password: 123456 password: 123456
cleanSession: false cleanSession: true
url: 127.0.0.1 url: 127.0.0.1
clientId: sdk_mqtt21 clientId: sdk_mqtt21
topics: topics:
- SDK/# - KN/#
qoss: qoss:
- 2 - 2
timeout: 30 timeout: 30
@ -140,11 +140,11 @@ file:
avatarMaxSize: 5 avatarMaxSize: 5
logging: logging:
file: file:
path: C:\log\ACS path: C:\logs\ACS
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
lucene: lucene:
index: index:
path: C:\lucene\index path: C:\acs\lucene\index
# Sa-Token配置 # Sa-Token配置
sa-token: sa-token:
@ -165,4 +165,3 @@ sa-token:
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀 # token 前缀
token-prefix: Bearer token-prefix: Bearer

Loading…
Cancel
Save