You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2014/03/26 05:53:14 UTC

[jira] [Assigned] (LOG4J2-498) Update unit tests to use Log4jConfig rule.

     [ https://issues.apache.org/jira/browse/LOG4J2-498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Sicker reassigned LOG4J2-498:
----------------------------------

    Assignee: Matt Sicker

> Update unit tests to use Log4jConfig rule.
> ------------------------------------------
>
>                 Key: LOG4J2-498
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-498
>             Project: Log4j 2
>          Issue Type: Sub-task
>          Components: Core
>    Affects Versions: 2.0-rc1
>            Reporter: Matt Sicker
>            Assignee: Matt Sicker
>              Labels: JUnit, Testing
>
> Every test that duplicates the following code (or some variant):
> {code:java}
> System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "config-file.xml");
> {code}
> Along with retrieving the updated LoggerContext, resetting StatusLogger, etc., can all be cleaned up by using the Log4jConfig rule. There is one catch, however, that I've noticed in several tests. Where a log file is created and deleted for a test, many tests call {{file.delete()}} at the beginning of the test. This is done because the logger context is retrieved after the call, but the rule sets up the logger context before the test is executed. Thus, these calls should be eliminated while leaving the {{file.delete()}} at the end of the test method.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org