Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
Project
Project
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
曲欣亮
sentinel
Commits
0f1841bc
Commit
0f1841bc
authored
Mar 12, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
10535be2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
LogService.java
src/main/java/com/egolm/film/api/service/LogService.java
+1
-1
LogServiceImpl.java
.../java/com/egolm/film/api/service/impl/LogServiceImpl.java
+2
-10
ExceptionHandler.java
src/main/java/com/egolm/film/config/ExceptionHandler.java
+1
-1
No files found.
src/main/java/com/egolm/film/api/service/LogService.java
View file @
0f1841bc
...
...
@@ -9,7 +9,7 @@ public interface LogService {
List
<
Map
<
String
,
Object
>>
queryLogList
(
String
type
,
String
username
,
Page
page
);
void
saveErrorLog
(
Throwable
ex
);
void
saveErrorLog
(
String
path
,
Throwable
ex
);
List
<
Map
<
String
,
Object
>>
queryErrorList
(
Page
page
);
...
...
src/main/java/com/egolm/film/api/service/impl/LogServiceImpl.java
View file @
0f1841bc
...
...
@@ -4,8 +4,6 @@ import java.util.Date;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,7 +12,6 @@ import com.egolm.common.jdbc.JdbcTemplate;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.film.api.service.LogService
;
import
com.egolm.film.bean.Fc_logs_error
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.util.SqlWhere
;
@Service
...
...
@@ -32,15 +29,10 @@ public class LogServiceImpl implements LogService {
}
@Override
public
void
saveErrorLog
(
Throwable
ex
)
{
String
requestUri
=
null
;
HttpServletRequest
request
=
WebMvcConfig
.
getRequest
();
if
(
request
!=
null
)
{
requestUri
=
request
.
getRequestURI
().
substring
(
request
.
getContextPath
().
length
());
}
public
void
saveErrorLog
(
String
path
,
Throwable
ex
)
{
Fc_logs_error
error
=
new
Fc_logs_error
();
error
.
setTitle
(
ex
.
getMessage
());
error
.
setPath
(
requestUri
);
error
.
setPath
(
path
);
error
.
setError
(
this
.
toStackString
(
ex
).
toString
());
error
.
setCreate_time
(
new
Date
());
jdbcTemplate
.
save
(
error
);
...
...
src/main/java/com/egolm/film/config/ExceptionHandler.java
View file @
0f1841bc
...
...
@@ -43,7 +43,7 @@ public class ExceptionHandler implements HandlerExceptionResolver {
if
(
displayInLog
)
{
logger
.
error
(
""
,
ex
);
try
{
logService
.
saveErrorLog
(
ex
);
logService
.
saveErrorLog
(
request
.
getRequestURI
(),
ex
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"错误日志保存失败"
,
e
);
}
...
...
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