Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
dm_project
Commits
91802923
Commit
91802923
authored
Jan 19, 2021
by
zhangc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gateway加入logback日志切分
parent
568b858b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
346 additions
and
21 deletions
+346
-21
pom.xml
jz-dm-apigateway/pom.xml
+0
-6
AuthFilter.java
...apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
+1
-1
AuthServiceImpl.java
...src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
+1
-1
ApiQueryService.java
.../main/java/com/jz/dm/service/request/ApiQueryService.java
+3
-3
application-prod.yml
jz-dm-apigateway/src/main/resources/application-prod.yml
+59
-1
application-test.yml
jz-dm-apigateway/src/main/resources/application-test.yml
+9
-6
application.yml
jz-dm-apigateway/src/main/resources/application.yml
+4
-2
banner.txt
jz-dm-apigateway/src/main/resources/banner.txt
+6
-0
logback-dev.xml
jz-dm-apigateway/src/main/resources/logback-dev.xml
+131
-0
logback-pro.xml
jz-dm-apigateway/src/main/resources/logback-pro.xml
+132
-0
pom.xml
jz-dm-common/pom.xml
+0
-1
No files found.
jz-dm-apigateway/pom.xml
View file @
91802923
...
...
@@ -33,12 +33,6 @@
<artifactId>
mybatis-plus-boot-starter
</artifactId>
</dependency>
<!-- 引入Druid依赖,阿里巴巴所提供的数据源 -->
<!-- <dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>-->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/filter/AuthFilter.java
View file @
91802923
...
...
@@ -218,7 +218,7 @@ public class AuthFilter extends AbstractFilter {
pObject
.
put
(
"assetsId"
,
assetsId
);
pObject
.
put
(
"userId"
,
userId
);
pObject
.
put
(
"dataPrice"
,
dataPrice
);
String
respResult
=
httpUtils
.
submitPost
(
balanceUrl
,
pObject
.
toString
());
String
respResult
=
httpUtils
.
submitPost
(
balanceUrl
+
"/mall/financeCustomerAssets/findAssets"
,
pObject
.
toString
());
JSONObject
result
=
JSONObject
.
parseObject
(
respResult
);
if
(
null
!=
result
)
{
if
(
200
!=
result
.
getInteger
(
"code"
))
{
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/impl/AuthServiceImpl.java
View file @
91802923
...
...
@@ -284,7 +284,7 @@ public class AuthServiceImpl implements AuthService {
AuthUserResponse
response
=
new
AuthUserResponse
();
ApiAuth
apiAuth
=
getAuthInfo
(
req
.
getAuthCode
());
if
(
null
==
apiAuth
)
{
return
Result
.
of_error
(
"认证
用户不存在
"
);
return
Result
.
of_error
(
"认证
信息不存在!
"
);
}
String
salt
=
RandomUtil
.
getStringRandom
(
8
);
UpdateWrapper
<
ApiAuth
>
update
=
new
UpdateWrapper
<>();
...
...
jz-dm-apigateway/src/main/java/com/jz/dm/service/request/ApiQueryService.java
View file @
91802923
...
...
@@ -61,8 +61,8 @@ public class ApiQueryService extends ApiParamVerify implements OpenApiService {
@Autowired
private
HttpsUtils
httpsUtils
;
@Value
(
"${data.bank.
withhold
Url}"
)
private
String
withhold
Url
;
@Value
(
"${data.bank.
balance
Url}"
)
private
String
balance
Url
;
/**
* API请求逻辑处理
...
...
@@ -198,7 +198,7 @@ public class ApiQueryService extends ApiParamVerify implements OpenApiService {
jsonReq
.
put
(
"userId"
,
userId
);
jsonReq
.
put
(
"dataPrice"
,
dataPrice
);
jsonReq
.
put
(
"callStatus"
,
bResult
);
//true 调用成功 扣款 false 调用失败,解冻金额
String
responseResult
=
httpsUtils
.
submitPost
(
withholdUrl
,
jsonReq
.
toString
());
String
responseResult
=
httpsUtils
.
submitPost
(
balanceUrl
+
"/mall/financeCustomerAssets/unfreezeMoney"
,
jsonReq
.
toString
());
JSONObject
paramsResult
=
JSONObject
.
parseObject
(
responseResult
);
if
(
null
!=
paramsResult
)
{
if
(
200
!=
paramsResult
.
getInteger
(
"code"
))
{
...
...
jz-dm-apigateway/src/main/resources/application-prod.yml
View file @
91802923
...
...
@@ -47,5 +47,63 @@ spring:
# 日志用的filter:log4j
# 防御sql注入的filter:wall
filters
:
stat
cache
:
type
:
CAFFEINE
caffeine
:
spec
:
maximumSize=1000,expireAfterWrite=30s
public-key
:
rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis
:
#database: 0
cluster
:
nodes
:
-
192.168.1.146:6379
-
192.168.1.146:6380
-
192.168.1.146:6381
-
192.168.1.146:6382
-
192.168.1.146:6383
-
192.168.1.146:6384
#使用redis管理session设置为redis,否则none
session
:
store-type
:
none
#切面启用
aop
:
proxy-target-class
:
true
auto
:
true
# ====================MybatisPlus====================
#ignoreRedis true存入 false不存 api.timeout.default
sendgrid
:
api-key
:
dmp
:
ignoreRedis
:
true
openapi
:
timeout
:
default
:
5000
max
:
5000
#流处理配置
windows
:
#文件流输出地址设置
name
:
stream
isWindows
:
true
#sentinel限流配置
sentinel
:
#sentinel每秒中最大的请求个数
resource
:
api.gateway
request
:
max
:
100
#数据银行调用配置
data
:
bank
:
balanceUrl
:
http://192.168.1.139:8081
#余额信息url
withholdUrl
:
http://192.168.1.139:8081/mall/financeCustomerAssets/unfreezeMoney
#扣款信通知url
token
:
#dataBank 制作验签
dataBank
:
dataBank123
#logback日志配置
logging
:
config
:
classpath:logback-pro.xml
level
:
com
:
zhl
:
springbootlogback
:
off
jz-dm-apigateway/src/main/resources/application-test.yml
View file @
91802923
...
...
@@ -94,15 +94,18 @@ sentinel: #sentinel每秒中最大的请求个数
#数据银行调用配置
data
:
bank
:
balanceUrl
:
http://192.168.1.139:8081/mall/financeCustomerAssets/findAssets
#余额信息url
withholdUrl
:
http://192.168.1.139:8081/mall/financeCustomerAssets/unfreezeMoney
#扣款信通知url
balanceUrl
:
http://192.168.1.139:8081
#余额信息url #扣款信通知url
token
:
#dataBank 制作验签
dataBank
:
dataBank123
apiRequest
:
testExample
:
apiKey
:
On6uAg3U09tLY28M
sign
:
F2A8E3CFE528D6AE5C5B075046653F3E
#logback日志配置
logging
:
config
:
classpath:logback-dev.xml
level
:
com
:
zhl
:
springbootlogback
:
off
jz-dm-apigateway/src/main/resources/application.yml
View file @
91802923
...
...
@@ -8,6 +8,7 @@ logging:
level
:
com.netflix.discovery
:
'
OFF'
org.springframework.cloud
:
'
DEBUG'
com.jz.dm
:
debug
#SPRING配置文件
spring
:
...
...
@@ -24,7 +25,8 @@ spring:
transport
:
# 项目本地会启动一个服务的端口号,默认8719,用于与sentinel-dashboard通讯
port
:
8719
# sentinel-dashboard服务地址 # sentinel-dashboard-1.6.0 的访问路径 ,启动方式java -jar sentinel-dashboard-1.6.0.jar
# sentinel-dashboard服务地址 # sentinel-dashboard-1.6.0 的访问路径 ,
#启动方式java -jar sentinel-dashboard-1.6.0.jar --server.port=9090
dashboard
:
localhost:9090
filter
:
# 需要进行限流监控的接口,多个匹配用逗号隔开
...
...
@@ -41,7 +43,7 @@ spring:
# 如果是放在resource目录 classpath:/mapper/*Mapper.xml
mapper-locations
:
classpath*:com/frame/**/**.xml,classpath*:mapping/**/**.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage
:
com.
frame.**.entity,com.frame.**.dto
typeAliasesPackage
:
com.
jz.dm.models.domian;com.jz.dm.models.dto;com.jz.dm.models.enity
global-config
:
#刷新mapper 调试神器
db-config
:
...
...
jz-dm-apigateway/src/main/resources/banner.txt
0 → 100644
View file @
91802923
____.__________ _____ __________.___ ___________________
| |\____ / / _ \\______ \ | \____ /\_ ___ \
| | / / / /_\ \| ___/ | / / / \ \/
/\__| | / /_ / | \ | | | / /_ \ \____
\________|/_______ \ \____|__ /____| |___| /_______ \ \______ /
\/ \/ \/ \/
\ No newline at end of file
jz-dm-apigateway/src/main/resources/logback-dev.xml
0 → 100644
View file @
91802923
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<substitutionProperty
name=
"log.proj"
value=
"gateway"
/>
<!-- 服务器 -->
<substitutionProperty
name=
"log.base"
value=
"/logs/${log.proj}"
/>
<!-- 本地 -->
<!--<substitutionProperty name="log.base" value="C:/Users/key/Desktop/logs/${log.proj}" />-->
<substitutionProperty
name=
"max.size"
value=
"100MB"
/>
<jmxConfigurator
/>
<appender
name=
"stdout"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [${log.proj}:%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
</appender>
<appender
name=
"file.debug"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- All Log Info -->
<File>
${log.base}/${log.proj}.log
</File>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
</appender>
<appender
name=
"file.info"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- <File>${log.base}/${log.proj}_info.log</File> -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_info_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"file.error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_error_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"file.warn"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_warn_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<!-- 临界值过滤器,过滤掉低于指定临界值的日志 -->
<level>
WARN
</level>
</filter>
</appender>
<!--异步输出 -->
<appender
name=
"async.file.info"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.info"
/>
</appender>
<appender
name=
"async.file.debug"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.debug"
/>
</appender>
<appender
name=
"async.file.warn"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.warn"
/>
</appender>
<appender
name=
"async.file.error"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.error"
/>
</appender>
<root
level=
"info"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<appender-ref
ref=
"async.file.debug"
/>
<appender-ref
ref=
"async.file.info"
/>
<appender-ref
ref=
"async.file.error"
/>
<appender-ref
ref=
"async.file.warn"
/>
</root>
<logger
name=
"io.lettuce.core.protocol.ConnectionWatchdog"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<level
value=
"ERROR"
/>
</logger>
<logger
name=
"io.lettuce.core.protocol.ReconnectionHandler"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<level
value=
"ERROR"
/>
</logger>
</configuration>
\ No newline at end of file
jz-dm-apigateway/src/main/resources/logback-pro.xml
0 → 100644
View file @
91802923
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<substitutionProperty
name=
"log.proj"
value=
"jz-dm-gateway"
/>
<!-- 服务器 -->
<substitutionProperty
name=
"log.base"
value=
"/logs/${log.proj}"
/>
<!-- 本地 -->
<!-- <substitutionProperty name="log.base" value="/Users/luoyichang/Desktop/jz/logs/${log.proj}" />-->
<substitutionProperty
name=
"max.size"
value=
"100MB"
/>
<jmxConfigurator
/>
<appender
name=
"stdout"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [${log.proj}:%thread] %-5level %logger{80} TraceId[%X{mdc_key}] - %msg%n
</pattern>
</layout>
</appender>
<appender
name=
"file.debug"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- All Log Info -->
<File>
${log.base}/${log.proj}.log
</File>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
</appender>
<appender
name=
"file.info"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- <File>${log.base}/${log.proj}_info.log</File> -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_info_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} TraceId[%X{mdc_key}] - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"file.error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_error_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"file.warn"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${log.base}/${log.proj}_warn_%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${max.size}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date [%thread] %-5level %logger{80} - %msg%n
</pattern>
</layout>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<!-- 临界值过滤器,过滤掉低于指定临界值的日志 -->
<level>
WARN
</level>
</filter>
</appender>
<!--异步输出 -->
<appender
name=
"async.file.info"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.info"
/>
</appender>
<appender
name=
"async.file.debug"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.debug"
/>
</appender>
<appender
name=
"async.file.warn"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.warn"
/>
</appender>
<appender
name=
"async.file.error"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<discardingThreshold>
0
</discardingThreshold>
<queueSize>
256
</queueSize>
<appender-ref
ref=
"file.error"
/>
</appender>
<root
level=
"info"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<appender-ref
ref=
"async.file.debug"
/>
<appender-ref
ref=
"async.file.info"
/>
<appender-ref
ref=
"async.file.error"
/>
<appender-ref
ref=
"async.file.warn"
/>
</root>
<logger
name=
"io.lettuce.core.protocol.ConnectionWatchdog"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<level
value=
"ERROR"
/>
</logger>
<logger
name=
"io.lettuce.core.protocol.ReconnectionHandler"
additivity=
"false"
>
<appender-ref
ref=
"stdout"
/>
<level
value=
"info"
/>
</logger>
</configuration>
\ No newline at end of file
jz-dm-common/pom.xml
View file @
91802923
...
...
@@ -19,7 +19,6 @@
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment