Class BasicTestCaptureCallLogger
CallLogger that captures log entries for testing logging itself.
 
 Instead of logging messages to a log file, messages are simply kept in an internal atomic string reference.
 Once a message has been logged, you can use the getMessage() or assertMessage() methods
 to access and evaluate it.
 
The following example shows how the capture logger can be associated with a REST class so that logged messages can be examined.
   
See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.juneau.rest.logger.CallLoggerCallLogger.Builder, CallLogger.Void
- 
Field SummaryFields inherited from class org.apache.juneau.rest.logger.CallLoggerSP_enabled, SP_level, SP_logger, SP_requestDetail, SP_responseDetail
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor using default settings.BasicTestCaptureCallLogger(BeanStore beanStore) Constructor using specific settings.
- 
Method SummaryModifier and TypeMethodDescriptionReturns an assertion of the last logged message.Returns an assertion of the last logged message and then deletes it internally.Returns the last logged message level.getLevel()Returns the last logged message level.Returns the last logged message.Returns the last logged message and then deletes it internally.Returns the last logged message level.protected CallLogger.BuilderInitializer.protected voidLogs the specified message to the logger.reset()Resets the internal message buffer.
- 
Constructor Details- 
BasicTestCaptureCallLoggerConstructor using specific settings.- Parameters:
- beanStore- The bean store containing injectable beans for this logger.
 
- 
BasicTestCaptureCallLoggerpublic BasicTestCaptureCallLogger()Constructor using default settings.Uses the same settings as CallLogger.
 
- 
- 
Method Details- 
initDescription copied from class:CallLoggerInitializer.Subclasses should override this method to make modifications to the builder used to create this logger. - Overrides:
- initin class- CallLogger
- Parameters:
- beanStore- The bean store containing injectable beans for this logger.
- Returns:
- A new builder object.
 
- 
logDescription copied from class:CallLoggerLogs the specified message to the logger.Subclasses can override this method to capture messages being sent to the logger and handle it differently. - Overrides:
- login class- CallLogger
- Parameters:
- level- The log level.
- msg- The log message.
- e- The exception.
 
- 
getMessageReturns the last logged message.- Returns:
- The last logged message, or null if nothing was logged.
 
- 
getMessageAndResetReturns the last logged message and then deletes it internally.- Returns:
- The last logged message.
 
- 
assertMessageReturns an assertion of the last logged message.- Returns:
- The last logged message as an assertion object.  Never null .
 
- 
assertMessageAndResetReturns an assertion of the last logged message and then deletes it internally.- Returns:
- The last logged message as an assertion object.  Never null .
 
- 
getLevelReturns the last logged message level.- Returns:
- The last logged message level, or null if nothing was logged.
 
- 
getThrownReturns the last logged message level.- Returns:
- The last logged message level, or null if nothing was logged.
 
- 
assertThrownReturns the last logged message level.- Returns:
- The last logged message level, or null if nothing was logged.
 
- 
resetResets the internal message buffer.- Returns:
- This object.
 
 
-