diff --git a/acs2/nladmin-system/src/main/java/org/nl/modules/lucene/config/LuceneAppender.java b/acs2/nladmin-system/src/main/java/org/nl/modules/lucene/config/LuceneAppender.java index 0aabe62..e5b316f 100644 --- a/acs2/nladmin-system/src/main/java/org/nl/modules/lucene/config/LuceneAppender.java +++ b/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 com.alibaba.fastjson.JSONObject; import com.alibaba.ttl.TransmittableThreadLocal; +import lombok.SneakyThrows; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -69,13 +70,16 @@ public class LuceneAppender extends AppenderBase { } + @SneakyThrows @Override protected void append(ILoggingEvent event) { String message = event.getFormattedMessage(); - String[] split = message.split("@"); - LuceneLogDto luceneLogDto = JSONObject.parseObject(split[1], LuceneLogDto.class); - Document document = new Document(); + try { + String[] split = message.split("@"); + LuceneLogDto luceneLogDto = JSONObject.parseObject(split[0], LuceneLogDto.class); + Document document = new Document(); + System.out.println("---lucene----"); //向document对象中添加域。 Map mdcPropertyMap = event.getMDCPropertyMap(); String traceId = mdcPropertyMap.get("traceId"); @@ -121,9 +125,11 @@ public class LuceneAppender extends AppenderBase { indexWriter.addDocument(document); indexWriter.commit(); } catch (IOException e) { + indexWriter.commit(); e.printStackTrace(); } } catch (Exception e) { + return; } } diff --git a/acs2/nladmin-system/src/main/resources/config/application-dev.yml b/acs2/nladmin-system/src/main/resources/config/application-dev.yml index 7b1aff5..7560959 100644 --- a/acs2/nladmin-system/src/main/resources/config/application-dev.yml +++ b/acs2/nladmin-system/src/main/resources/config/application-dev.yml @@ -6,9 +6,9 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource 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} - password: ${DB_PWD:password} + password: ${DB_PWD:root} # 初始连接数 initial-size: 5 # 最小连接数 @@ -52,11 +52,25 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:15} + database: ${REDIS_DB:3} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} 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: # 登录缓存 @@ -126,8 +140,11 @@ file: avatarMaxSize: 5 logging: file: - path: C:\acs + path: C:\logs\ACS config: classpath:logback-spring.xml +lucene: + index: + path: C:\acs2\lucene\index # Sa-Token配置 sa-token: @@ -147,5 +164,4 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: Bearer - + token-prefix: Bearer \ No newline at end of file diff --git a/acs2/nladmin-system/src/main/resources/config/application-dev2.yml b/acs2/nladmin-system/src/main/resources/config/application-dev2.yml index 09984e9..3b2804d 100644 --- a/acs2/nladmin-system/src/main/resources/config/application-dev2.yml +++ b/acs2/nladmin-system/src/main/resources/config/application-dev2.yml @@ -52,7 +52,7 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:3} + database: ${REDIS_DB:1} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -142,6 +142,9 @@ logging: file: path: C:\logs\ACS config: classpath:logback-spring.xml +lucene: + index: + path: C:\acs\lucene\index # Sa-Token配置 sa-token: @@ -161,5 +164,4 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: Bearer - + token-prefix: Bearer \ No newline at end of file diff --git a/acs2/nladmin-system/src/main/resources/config/application-prod.yml b/acs2/nladmin-system/src/main/resources/config/application-prod.yml index 77d8caf..89ebb29 100644 --- a/acs2/nladmin-system/src/main/resources/config/application-prod.yml +++ b/acs2/nladmin-system/src/main/resources/config/application-prod.yml @@ -6,9 +6,9 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource 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} - password: ${DB_PWD:password} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 # 最小连接数 @@ -52,7 +52,7 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:3} + database: ${REDIS_DB:1} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -61,11 +61,11 @@ spring: active: true username: root password: 123456 - cleanSession: false + cleanSession: true url: 127.0.0.1 clientId: sdk_mqtt21 topics: - - SDK/# + - KN/# qoss: - 2 timeout: 30 @@ -140,11 +140,11 @@ file: avatarMaxSize: 5 logging: file: - path: C:\log\ACS + path: C:\logs\ACS config: classpath:logback-spring.xml lucene: index: - path: C:\lucene\index + path: C:\acs\lucene\index # Sa-Token配置 sa-token: @@ -164,5 +164,4 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: Bearer - + token-prefix: Bearer \ No newline at end of file