Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
76d7f452
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
76d7f452
编写于
11月 02, 2015
作者:
S
Sebastien Deleuze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert most SPR-13100 changes since SPR-13267 was a better fix
Issue: SPR-13596
上级
62cd6ad5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
15 deletion
+10
-15
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java
...web/servlet/handler/AbstractHandlerExceptionResolver.java
+10
-15
未找到文件。
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java
浏览文件 @
76d7f452
...
...
@@ -53,7 +53,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
private
Class
<?>[]
mappedHandlerClasses
;
private
Log
warnLogger
=
LogFactory
.
getLog
(
getClass
())
;
private
Log
warnLogger
;
private
boolean
preventResponseCaching
=
false
;
...
...
@@ -96,15 +96,14 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
* Set the log category for warn logging. The name will be passed to the underlying logger
* implementation through Commons Logging, getting interpreted as a log category according
* to the logger's configuration.
* <p>Default is warn logging using the {@link AbstractHandlerExceptionResolver} class name derived logger.
* <p>Set to {@code null} to disable warn logging.
* <p>Override the {@link #logException} method for custom logging.
* <p>Default is no warn logging. Specify this setting to activate warn logging into a specific
* category. Alternatively, override the {@link #logException} method for custom logging.
* @see org.apache.commons.logging.LogFactory#getLog(String)
* @see org.apache.log4j.Logger#getLogger(String)
* @see java.util.logging.Logger#getLogger(String)
*/
public
void
setWarnLogCategory
(
String
loggerName
)
{
this
.
warnLogger
=
(
loggerName
!=
null
?
LogFactory
.
getLog
(
loggerName
)
:
null
);
this
.
warnLogger
=
LogFactory
.
getLog
(
loggerName
);
}
/**
...
...
@@ -128,17 +127,13 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
Object
handler
,
Exception
ex
)
{
if
(
shouldApplyTo
(
request
,
handler
))
{
// Log exception
at debug log level
// Log exception
, both at debug log level and at warn level, if desired.
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
"Resolving exception from handler ["
+
handler
+
"]: "
+
ex
);
}
prepareResponse
(
ex
,
response
);
ModelAndView
mav
=
doResolveException
(
request
,
response
,
handler
,
ex
);
if
(
mav
!=
null
)
{
// Log exception message at warn log level
logException
(
ex
,
request
);
}
return
mav
;
prepareResponse
(
ex
,
response
);
return
doResolveException
(
request
,
response
,
handler
,
ex
)
;
}
else
{
return
null
;
...
...
@@ -176,7 +171,8 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
}
/**
* Log the given exception message at warn level.
* Log the given exception at warn level, provided that warn logging has been
* activated through the {@link #setWarnLogCategory "warnLogCategory"} property.
* <p>Calls {@link #buildLogMessage} in order to determine the concrete message to log.
* @param ex the exception that got thrown during handler execution
* @param request current HTTP request (useful for obtaining metadata)
...
...
@@ -197,8 +193,7 @@ public abstract class AbstractHandlerExceptionResolver implements HandlerExcepti
* @return the log message to use
*/
protected
String
buildLogMessage
(
Exception
ex
,
HttpServletRequest
request
)
{
String
message
=
(
ex
!=
null
?
ex
.
getMessage
()
:
"null"
);
return
"Handler execution resulted in exception: "
+
(
message
!=
null
?
message
:
"null"
);
return
"Handler execution resulted in exception: "
+
ex
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录