Class ConfigureLoggingSetupTask
- java.lang.Object
-
- org.jboss.as.arquillian.setup.ConfigureLoggingSetupTask
-
- All Implemented Interfaces:
ServerSetupTask
public class ConfigureLoggingSetupTask extends Object implements ServerSetupTask
A setup task for configuring loggers for tests.You can define the log levels and logger names in two ways. The first is to pass a map of known logger levels with associated logger names to the constructor. The other is via a system property.
To set the levels and logger names via a system property, use a key of
wildfly.logging.level.${level}wherelevelis one of the following:- all
- trace
- debug
- info
- warn
- error
- off
Example:
-Dwildfly.logging.level.debug=org.wildfly.security,org.jboss.resteasyWhen using the constructor, the map should consist of a known log level as the key and loggers to be associated with that level as the value of the map. Example:
Note that when using the map constructor, you can still use the system property and the maps will be merged.public class WildFlyLoggingSetupTask extends ConfigurationLoggingSetupTask { public WildFlyLoggingSetupTask() { super(Map.of("DEBUG", Set.of("org.wildfly.core", "org.wildfly"})); })- Author:
- James R. Perkins
-
-
Constructor Summary
Constructors Constructor Description ConfigureLoggingSetupTask()Creates a new setup task which configures theconsole-handler=CONSOLEhandler to allow all log levels.ConfigureLoggingSetupTask(String handlerType, String handlerName)Creates a new setup task which configures the handler to allow all log levels.ConfigureLoggingSetupTask(String handlerType, String handlerName, Map<String,Set<String>> logLevels)Creates a new setup task which configures the handler to allow all log levels.ConfigureLoggingSetupTask(Map<String,Set<String>> logLevels)Creates a new setup task which configures theconsole-handler=CONSOLEhandler to allow all log levels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetup(ManagementClient client, String containerId)Execute any necessary setup work that needs to happen before the first deployment to the given container.voidtearDown(ManagementClient managementClient, String containerId)Execute any tear down work that needs to happen after the last deployment associated with the given container has been undeployed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.arquillian.api.ServerSetupTask
executeOperation, executeOperation, executeOperation, executeOperation
-
-
-
-
Constructor Detail
-
ConfigureLoggingSetupTask
public ConfigureLoggingSetupTask()
Creates a new setup task which configures theconsole-handler=CONSOLEhandler to allow all log levels. Then configures, either by modifying or adding, the loggers represented by the values from the system properties.
-
ConfigureLoggingSetupTask
public ConfigureLoggingSetupTask(String handlerType, String handlerName)
Creates a new setup task which configures the handler to allow all log levels. Then configures, either by modifying or adding, the loggers represented by system properties.- Parameters:
handlerType- the handler type which should be modified to ensure it allows all log levels, ifnullconsole-handlerwill be usedhandlerName- the name of the handler which should be modified to ensure it allows all log levels, ifnullconsole-handlerwill be used
-
ConfigureLoggingSetupTask
public ConfigureLoggingSetupTask(Map<String,Set<String>> logLevels)
Creates a new setup task which configures theconsole-handler=CONSOLEhandler to allow all log levels. Then configures, either by modifying or adding, the loggers represented by the values of the map passed in. The key of the map is the level desired for each logger.The map consists of levels as the key and a set of logger names as the value for each level.
- Parameters:
logLevels- the map of levels and loggers
-
ConfigureLoggingSetupTask
public ConfigureLoggingSetupTask(String handlerType, String handlerName, Map<String,Set<String>> logLevels)
Creates a new setup task which configures the handler to allow all log levels. Then configures, either by modifying or adding, the loggers represented by the values of the map passed in. The key of the map is the level desired for each logger.If the
handlerTypeisnullthe value will beconsole-handler. If thehandlerNameisnullthe value used will beCONSOLE.The map consists of levels as the key and a set of logger names as the value for each level.
- Parameters:
handlerType- the handler type which should be modified to ensure it allows all log levels, ifnullconsole-handlerwill be usedhandlerName- the name of the handler which should be modified to ensure it allows all log levels, ifnullconsole-handlerwill be usedlogLevels- the map of levels and loggers
-
-
Method Detail
-
setup
public void setup(ManagementClient client, String containerId) throws Exception
Description copied from interface:ServerSetupTaskExecute any necessary setup work that needs to happen before the first deployment to the given container.Note on exception handling: If an implementation of this method throws any exception, the implementation can assume the following:
- Any subsequent
ServerSetupTasksassociated with test classwill not be executed. - The deployment event that triggered the call to this method will be skipped.
- The
tearDownmethod of the instance that threw the exception will not be invoked. Therefore, implementations that throwAssumptionViolatedException, or any other exception, should do so before altering any system state. - The
tearDownmethod for any previously executedServerSetupTasksassociated with test classwill be invoked.
If any other exception is thrown, the
ServerSetupTask.tearDown(ManagementClient, String)will be executed, including this implementationstearDown(), re-throwing the original exception. The original exception will have any other exceptions thrown in thetearDown()methods add as suppressed messages.- Specified by:
setupin interfaceServerSetupTask- Parameters:
client- management client to use to interact with the containercontainerId- id of the container to which the deployment will be deployed- Throws:
Exception- if a failure occurs
- Any subsequent
-
tearDown
public void tearDown(ManagementClient managementClient, String containerId) throws Exception
Description copied from interface:ServerSetupTaskExecute any tear down work that needs to happen after the last deployment associated with the given container has been undeployed.- Specified by:
tearDownin interfaceServerSetupTask- Parameters:
managementClient- management client to use to interact with the containercontainerId- id of the container to which the deployment will be deployed- Throws:
Exception- if a failure occurs
-
-