Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Logging

rawagner edited this page Aug 8, 2017 · 1 revision

Logging in RedDeer is similar to any other logging system like log4j or others. There are some differences though. First, it is simpler and doesn't require any xml configuration. On the other hand it doesn't provide as fine and complex possibilities as log4j does (like custom formatting, etc.). It also brings some additional logging types which are not available in log4j and which are handy for UI testing.

Using the logger

When you want to use the logger in your your class you just must define Logger from org.eclipse.reddeer.common.logging package.

private final Logger log = Logger.getLogger(<your class>);

then you can log your messages by using the logger

log.info("Server " + serverName + " is started");

Log types

Log message type Usage description
FATAL fatal message are mostly for reporting halt state or other serious issues
ERROR error message for reporting any unexpected state and errors
DUMP should be used after error message to provide additional useful information related to the error
STEP describes hi-level test steps describing high level test flow, should used only in test class
WARN any warning message which indicates anything outside normal state
INFO general type for information type messages
DEBUG low-level debug information usable for analyzing issues and bugs
TRACE low-level trace information that indicates tracking through the code

Log filters

There are these log filter switches that can be used to filter your log for message type or message level according to your needs. You can combine them if needed.

Parameter Default value Type Description Source
rd.logMessageFilter ALL pipe separated string filters log messages according to settings. Possible values are none,trace,debug,error,warn,info,step,error,fatal,all. Values are not case sensitive.
rd.logLevel ALL string filters log messages according to settings. Possible values are none,trace,debug,error,warn,info,step,error,fatal,all. Values are not case sensitive. ExecutionSettings

So for example if you want to see just STEP, INFO and ERROR messages then just add these parameters to your run parameters: -Drd.logMessageLevel="step|info|error"

Clone this wiki locally