2010-12-07 36 views
1

我目前按照本教程學習SPRING:http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html問題與ANT輸出,Java日誌和Spring教程

它所有的作品,但螞蟻輸出始終顯示「標準誤差」正常的日誌記錄的內容,我認爲是錯誤。

$ ant tests 
Buildfile: build.xml 

build: 

buildtests: 

    [javac] Compiling 1 source file to /Users/Shared/Projects/springapp/war/WEB-INF/classes 

tests: 

    [junit] Running springapp.web.HelloWorldControllerTests 
    [junit] Oct 30, 2007 11:31:43 PM springapp.web.HelloController handleRequest 
    [junit] INFO: Returning hello view 
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.03 sec 
    [junit] Testsuite: springapp.web.HelloWorldControllerTests 
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.03 sec 
    [junit] ------------- Standard Error ----------------- 
    [junit] Oct 30, 2007 11:31:43 PM springapp.web.HelloController handleRequest 
    [junit] INFO: Returning hello view 
    [junit] ------------- ---------------- --------------- 

BUILD SUCCESSFUL 
Total time: 2 seconds 

我該如何改變這種行爲?記錄輸出不是一個錯誤,還是它的螞蟻?感謝您的任何想法和澄清!

回答

1

在鏈接教程中查看「junit」任務如下所示。

將其更改爲showoutput="false"以隱藏測試輸出。我猜這個教程把它打開了,這樣你就可以看到發生了什麼,但通常它隱含地是'假' - 如果你省略了'showoutput'屬性的默認值。

<junit printsummary="on" 
    fork="false" 
    haltonfailure="false" 
    failureproperty="tests.failed" 
    showoutput="true"> 
    <classpath refid="master-classpath"/> 
    <formatter type="brief" usefile="false"/> 

    <batchtest> 
     <fileset dir="${build.dir}"> 
      <include name="**/*Tests.*"/> 
     </fileset> 
    </batchtest> 

</junit> 
+0

這將更改輸出,以便第一條INFO消息不再顯示。我怎樣才能擺脫STANDARD ERROR部分中的INFO消息。這不是一個錯誤,只是一些日誌記錄... – Czar 2010-12-09 10:01:56