Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
a07c5ba4
Commit
a07c5ba4
authored
Jan 18, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
ee1a644f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
LogServiceImpl.java
.../java/com/egolm/film/api/service/impl/LogServiceImpl.java
+21
-7
Fc_logs_error.java
src/main/java/com/egolm/film/bean/Fc_logs_error.java
+11
-0
No files found.
src/main/java/com/egolm/film/api/service/impl/LogServiceImpl.java
View file @
a07c5ba4
...
@@ -30,18 +30,32 @@ public class LogServiceImpl implements LogService {
...
@@ -30,18 +30,32 @@ public class LogServiceImpl implements LogService {
@Override
@Override
public
void
saveErrorLog
(
Throwable
ex
)
{
public
void
saveErrorLog
(
Throwable
ex
)
{
Fc_logs_error
error
=
new
Fc_logs_error
();
error
.
setTitle
(
ex
.
getMessage
());
error
.
setError
(
this
.
toStackString
(
ex
,
0
).
toString
());
error
.
setCreate_time
(
new
Date
());
jdbcTemplate
.
save
(
error
);
}
public
StringBuffer
toStackString
(
Throwable
ex
,
Integer
level
)
{
StringBuffer
stack
=
new
StringBuffer
();
if
(
ex
!=
null
)
{
if
(
ex
!=
null
)
{
StringBuffer
stack
=
new
StringBuffer
();
StringBuffer
prefix
=
new
StringBuffer
();
stack
.
append
(
ex
.
getMessage
()).
append
(
"\n"
);
Integer
tmpLevel
=
(
level
==
null
||
level
<
0
)
?
0
:
level
;
for
(
int
i
=
0
;
i
<
tmpLevel
;
i
++)
{
prefix
.
append
(
" "
);
}
tmpLevel
+=
1
;
StackTraceElement
[]
elms
=
ex
.
getStackTrace
();
StackTraceElement
[]
elms
=
ex
.
getStackTrace
();
for
(
StackTraceElement
elm
:
elms
)
{
for
(
StackTraceElement
elm
:
elms
)
{
stack
.
append
(
elm
.
getClassName
()).
append
(
"."
).
append
(
elm
.
getMethodName
()).
append
(
"("
).
append
(
elm
.
getFileName
()).
append
(
" "
).
append
(
elm
.
getLineNumber
()).
append
(
")\n"
);
stack
.
append
(
prefix
).
append
(
elm
.
getClassName
()).
append
(
"."
).
append
(
elm
.
getMethodName
()).
append
(
"("
).
append
(
elm
.
getFileName
()).
append
(
" "
).
append
(
elm
.
getLineNumber
()).
append
(
")\n"
);
}
stack
.
append
(
"\n\n\n"
).
append
(
"Cause By: \n"
).
append
(
this
.
toStackString
(
ex
.
getCause
(),
tmpLevel
));
for
(
Throwable
e
:
ex
.
getSuppressed
())
{
stack
.
append
(
"\n\n\n"
).
append
(
"Suppressed By: \n"
).
append
(
this
.
toStackString
(
e
,
tmpLevel
));
}
}
Fc_logs_error
error
=
new
Fc_logs_error
();
error
.
setError
(
stack
.
toString
());
error
.
setCreate_time
(
new
Date
());
jdbcTemplate
.
save
(
error
);
}
}
return
stack
;
}
}
}
}
src/main/java/com/egolm/film/bean/Fc_logs_error.java
View file @
a07c5ba4
...
@@ -18,6 +18,9 @@ public class Fc_logs_error implements java.io.Serializable {
...
@@ -18,6 +18,9 @@ public class Fc_logs_error implements java.io.Serializable {
private
Integer
id
;
private
Integer
id
;
@Column
(
columnDefinition
=
"text"
)
@Column
(
columnDefinition
=
"text"
)
private
String
title
;
@Column
(
columnDefinition
=
"longtext"
)
private
String
error
;
private
String
error
;
@Column
(
columnDefinition
=
"datetime"
)
@Column
(
columnDefinition
=
"datetime"
)
...
@@ -32,6 +35,14 @@ public class Fc_logs_error implements java.io.Serializable {
...
@@ -32,6 +35,14 @@ public class Fc_logs_error implements java.io.Serializable {
return
id
;
return
id
;
}
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setError
(
String
error
)
{
public
void
setError
(
String
error
)
{
this
.
error
=
error
;
this
.
error
=
error
;
}
}
...
...
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