Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
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
huluobin
gogirl-miniapp-backend
Commits
7bcc363d
Commit
7bcc363d
authored
Jul 23, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
战术更新
parent
86ce4857
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
19 deletions
+12
-19
ErrorCode.java
...com/gogirl/infrastructure/common/exception/ErrorCode.java
+2
-1
RequestLogFilter.java
...gogirl/infrastructure/common/filter/RequestLogFilter.java
+5
-2
MvcInterceptorConfig.java
...frastructure/common/interceptor/MvcInterceptorConfig.java
+1
-5
SessionHandlerInterceptor.java
...ructure/common/interceptor/SessionHandlerInterceptor.java
+0
-2
logback-spring.xml
src/main/resources/logback-spring.xml
+4
-9
No files found.
src/main/java/com/gogirl/infrastructure/common/exception/ErrorCode.java
View file @
7bcc363d
...
...
@@ -27,7 +27,8 @@ public enum ErrorCode {
ErrorCode
(
Integer
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
Integer
getCode
()
{
...
...
src/main/java/com/gogirl/infrastructure/common/filter/RequestLogFilter.java
View file @
7bcc363d
package
com
.
gogirl
.
infrastructure
.
common
.
filter
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
org.slf4j.MDC
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.stereotype.Component
;
...
...
@@ -25,12 +26,14 @@ public class RequestLogFilter implements Filter {
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
request
.
setAttribute
(
"logTraceId"
,
IdWorker
.
getIdStr
());
String
traceId
=
IdWorker
.
getIdStr
();
request
.
setAttribute
(
"traceId"
,
traceId
);
MDC
.
put
(
"traceId"
,
traceId
);
chain
.
doFilter
(
request
,
response
);
}
@Override
public
void
destroy
()
{
MDC
.
clear
();
}
}
src/main/java/com/gogirl/infrastructure/common/
config/config
/MvcInterceptorConfig.java
→
src/main/java/com/gogirl/infrastructure/common/
interceptor
/MvcInterceptorConfig.java
View file @
7bcc363d
package
com
.
gogirl
.
infrastructure
.
common
.
config
.
config
;
package
com
.
gogirl
.
infrastructure
.
common
.
interceptor
;
import
com.gogirl.infrastructure.common.interceptor.AuthHandlerInterceptor
;
import
com.gogirl.infrastructure.common.interceptor.LogHandlerInterceptor
;
import
com.gogirl.infrastructure.common.interceptor.LoginHandlerInterceptor
;
import
com.gogirl.infrastructure.common.interceptor.SessionHandlerInterceptor
;
import
lombok.AllArgsConstructor
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
...
...
src/main/java/com/gogirl/infrastructure/common/interceptor/SessionHandlerInterceptor.java
View file @
7bcc363d
...
...
@@ -39,13 +39,11 @@ public class SessionHandlerInterceptor implements HandlerInterceptor {
return
true
;
}
if
(
sourceFrom
.
equals
(
"customer"
))
{
long
time
=
System
.
currentTimeMillis
();
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
if
(
gogirlToken
!=
null
)
{
SessionUtils
.
putCustomerToken
(
gogirlToken
);
}
HandlerMethod
h
=
(
HandlerMethod
)
handler
;
log
.
info
(
h
.
getMethod
()
+
"消耗时间:"
+
(
System
.
currentTimeMillis
()
-
time
));
}
if
(
sourceFrom
.
equals
(
"technician"
))
{
...
...
src/main/resources/logback-spring.xml
View file @
7bcc363d
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"true"
>
<property
name=
"contextName"
value=
"gogirl
-member
"
/>
<property
name=
"contextName"
value=
"gogirl"
/>
<property
name=
"LOG_HOME"
value=
"log"
/>
<property
name=
"LOG_PATTERN"
value=
"%d{yyyy-MM-dd HH:mm:ss.SSS} %X{reqId} %X{serverIp} %X{serverName} %-5level %logger{100} - %msg%n"
/>
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<!-- 彩色日志格式 -->
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ${traceId} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<contextName>
${contextName}
</contextName>
...
...
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