You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Bryant Luk (JIRA)" <ji...@apache.org> on 2010/03/05 00:13:41 UTC

[jira] Created: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
-----------------------------------------------------------------------------------------------------------------------------------

                 Key: WINK-261
                 URL: https://issues.apache.org/jira/browse/WINK-261
             Project: Wink
          Issue Type: Improvement
          Components: Testsuite
            Reporter: Bryant Luk


It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844636#action_12844636 ] 

Hudson commented on WINK-261:
-----------------------------

Integrated in Wink-Trunk-JDK1.5 #293 (See [http://hudson.zones.apache.org/hudson/job/Wink-Trunk-JDK1.5/293/])
    : enable logging for mvn builds if desired.  Also add util class(es) to capture log output in a junit test method to unittest log output if desired


> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>             Fix For: 1.0, 1.1
>
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Rheinheimer closed WINK-261.
---------------------------------


Issue is resolved.  Closing per Bryant's approval to do so.

> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>             Fix For: 1.0, 1.1
>
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Rheinheimer reassigned WINK-261:
-------------------------------------

    Assignee: Mike Rheinheimer

> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844615#action_12844615 ] 

Mike Rheinheimer commented on WINK-261:
---------------------------------------

Committed in 922389.

There are two changes in this commit:

1)  If you desire to turn on debug logging in maven build of the whole tree or of a particular component, you only need to add a param to your mvn command line:

     mvn -Djava.util.logging.config.file=/full/path/to/logging.properties

     There is a default properties file at wink-component-test-support/src/main/resources/logging.properties.
     The log output goes into the respective target/surefire-reports/*-output.txt files.

     To perform the same in Eclipse, pass -Djava.util.logging.config.file=/full/path/to/logging.properties in the JVM args field
     in the Run dialog box.  You'll get output in the *-output.txt files and on the Eclipse console.

2)  If you desire to capture debug output in a specific unittest method to perform asserts on the log output itself, you can now do so!  You can write a test like so:

    public void testLogging() throws Exception {
        WinkLogHandler.turnLoggingCaptureOn();  // WinkLogHandler imported from wink-component-test-support module
        ApplicationFileLoader applicationFileLoader =
            new ApplicationFileLoader("application//custom.app");
        WinkLogHandler.turnLoggingCaptureOff();
        ArrayList<LogRecord> logRecords = WinkLogHandler.getRecords();
        assertEquals(14, logRecords.size());
        WinkLogHandler.clearRecords();  // recommend doing this so static ArrayList of LogRecords is clear for next test
    }

I'll duplicate these instructions to the dev email list.

> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>             Fix For: 1.0, 1.1
>
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Rheinheimer resolved WINK-261.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1
                   1.0

> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>             Fix For: 1.0, 1.1
>
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-261) Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted

Posted by "Mike Rheinheimer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841916#action_12841916 ] 

Mike Rheinheimer commented on WINK-261:
---------------------------------------

I have a prototype of this ready to go.  Will post patch shortly.

> Add way to be able to capture logging warnings in unit tests so we can correctly identify when messages are correctly being emitted
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WINK-261
>                 URL: https://issues.apache.org/jira/browse/WINK-261
>             Project: Wink
>          Issue Type: Improvement
>          Components: Testsuite
>            Reporter: Bryant Luk
>            Assignee: Mike Rheinheimer
>
> It would be nice if we had a way to capture the slf4j logs while running a unit test so that we can later add assertions that certain warnings were correctly made.  Not sure the best approach or if there's an easy pre-existing solution.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.