public class LogConfig extends Object
Note that only log things known to REST Assured (i.e. the request- and response specifications) will be logged. If you need to log what's actually sent on the wire refer to the HTTP Client logging docs or use an external tool such as Wireshark.
| Constructor and Description |
|---|
LogConfig()
Configure the default stream to use the System.out stream (default).
|
LogConfig(PrintStream defaultPrintStream,
boolean prettyPrintingEnabled)
Configure pretty printing and the default stream where logs should be written if not specified explicitly by a filter.
|
| Modifier and Type | Method and Description |
|---|---|
LogConfig |
and()
Syntactic sugar.
|
PrintStream |
defaultStream() |
LogConfig |
defaultStream(PrintStream printStream)
Specify a new default stream to the print to.
|
LogConfig |
enableLoggingOfRequestAndResponseIfValidationFails()
Enable logging of both the request and the response if REST Assureds test validation fails.
|
LogConfig |
enableLoggingOfRequestAndResponseIfValidationFails(LogDetail logDetail)
Enable logging of both the request and the response if REST Assureds test validation fails with the specified log detail
|
LogConfig |
enablePrettyPrinting(boolean shouldEnable)
Specify a whether or not to enable pretty printing by default.
|
boolean |
isLoggingOfRequestAndResponseIfValidationFailsEnabled() |
boolean |
isPrettyPrintingEnabled() |
static LogConfig |
logConfig() |
LogDetail |
logDetailOfRequestAndResponseIfValidationFails() |
public LogConfig()
public LogConfig(PrintStream defaultPrintStream, boolean prettyPrintingEnabled)
given().log().all()...or
expect().log.ifError(). ..It will not override explicit streams defined by using the
RequestLoggingFilter or the ResponseLoggingFilter.defaultPrintStream - The default print stream to use for the LogSpecification's.prettyPrintingEnabled - Enable or disable pretty printing when logging. Pretty printing is only possible when content-type is XML, JSON or HTML.public PrintStream defaultStream()
public LogConfig defaultStream(PrintStream printStream)
printStream - The streampublic boolean isPrettyPrintingEnabled()
true if pretty printing is enabled, false otherwise.public boolean isLoggingOfRequestAndResponseIfValidationFailsEnabled()
true if request and response logging is enabled if test validation fails, false otherwise.public LogDetail logDetailOfRequestAndResponseIfValidationFails()
public LogConfig enablePrettyPrinting(boolean shouldEnable)
shouldEnable - true if pretty-printing should be enabled, false otherwise.public LogConfig enableLoggingOfRequestAndResponseIfValidationFails()
public LogConfig enableLoggingOfRequestAndResponseIfValidationFails(LogDetail logDetail)
logDetail - The log detail to show in the logpublic static LogConfig logConfig()
public LogConfig and()
Copyright © 2010–2014. All rights reserved.