Introduce LoggingResultHandler in Spring MVC Test

Prior to this commit, the Spring MVC Test framework only provided
support for printing debug information about the MvcResult to STDOUT.

This commit introduces support for logging `MvcResult` details at
`DEBUG` level via the Apache Commons Logging API. In addition, this
commit introduces additional `print(..)` variants for printing debug
information to custom output streams and writers.

Specifically, `MockMvcResultHandlers` has been augmented with the
following new static methods:

 - `log()`
 - `print(OutputStream)`
 - `print(Writer)`

Issue: SPR-13171
This commit is contained in:
Sam Brannen
2015-06-27 21:53:19 +02:00
parent 895d43a2b3
commit 693dcba867
6 changed files with 138 additions and 32 deletions

View File

@@ -3,7 +3,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%-5p] [%c] - %m%n
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.file=build/spring-test.log
log4j.appender.file.file=bin/spring-test.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%c] - %m%n
@@ -11,20 +11,21 @@ log4j.rootCategory=ERROR, console, file
log4j.logger.org.springframework.beans=WARN
log4j.logger.org.springframework.test.context=WARN
log4j.logger.org.springframework.test.context.TestContext=WARN
log4j.logger.org.springframework.test.context.TestContextManager=WARN
log4j.logger.org.springframework.test.context.ContextLoaderUtils=WARN
log4j.logger.org.springframework.test.context.cache=WARN
log4j.logger.org.springframework.test.context.junit4.rules=WARN
log4j.logger.org.springframework.test.context.transaction.TransactionalTestExecutionListener=WARN
log4j.logger.org.springframework.test.context.web=WARN
log4j.logger.org.springframework.test.context=WARN
log4j.logger.org.springframework.test.context.cache=WARN
log4j.logger.org.springframework.test.context.junit4.rules=WARN
#log4j.logger.org.springframework.test.context.support=INFO
#log4j.logger.org.springframework.test.context.support.DelegatingSmartContextLoader=INFO
#log4j.logger.org.springframework.test.context.support.AbstractGenericContextLoader=INFO
#log4j.logger.org.springframework.test.context.support.AnnotationConfigContextLoader=INFO
log4j.logger.org.springframework.test.web.servlet.result=DEBUG
#log4j.logger.org.springframework.test=TRACE