-
Notifications
You must be signed in to change notification settings - Fork 11
Logging
We added logging support via [https://www.slf4j.org/](Simple Logging Facade for Java (SLF4J)). Doing so everybody is able to configure a logging framework.
With version 3.3.0 of Neodymium we added a basic logging configuration to the framework itself. We decided to use [https://logging.apache.org/log4j/2.x/](Apache Log4j 2) as a logging framework.
Now you should be able to instantiate a logger and find messages of level warning
and above within the console. Additionally, every logging event of severity error
or above will be appended to [PROJECT_PATH]\target\log\neodymium-error.log
.
Unfortunately, Log4j doesn't provide a non-programmatic way of extending an existing configuration. Hence, the easiest way to change our configuration is to overwrite ours with your own.
The following listing shows the Log4j configuration provided by Neodymium. This is a good starting point to write your own. Please check out the official [https://logging.apache.org/log4j/2.x/manual/configuration.html](Log4j documentation) for more details.
status = warn
name = NeodymiumConfiguration
property.filename = target/log/neodymium-error.log
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{HH:mm:ss} %p - %c{1.}: %m%n
appender.console.filter.threshold.type = ThresholdFilter
appender.console.filter.threshold.level = trace
appender.file.type = File
appender.file.name = FILE
appender.file.append = true
appender.file.fileName = ${filename}
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = %d %p - %c{1.} [%t]: %m%n
appender.file.filter.threshold.type = ThresholdFilter
appender.file.filter.threshold.level = error
rootLogger.level = warn
rootLogger.appenderRef.file.ref = FILE
rootLogger.appenderRef.console.ref = STDOUT
Before you can log a message you'll need a proper logger instance. The easiest and recommended way to retrieve a Logger
instance is to use LoggerFactory.getLogger()
as follows:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
Logger logger = LoggerFactory.getLogger("NAME_OF_LOGGER"));
logger.trace("trace");
logger.debug("debug");
logger.info("info");
logger.warn("warn");
logger.error("error");
Overview
Neodymium features
- Neodymium configuration properties
- Neodymium context
- Utility classes
- Test data provider
- Test Environments
- Multi browser support
- Applitools Plugin
- Localization
- Highlight and Wait
- Advanced Screenshots
- Seperate Browser Sessions for Setup and Cleanup
Best practices and used frameworks
Special