我們正在準備將我們的JSF 2(MyFaces with Facelets頁面)應用程序移至生產環境。目前,我們的控制檯日誌(在WebSphere V8 SystemOut.log中)與大量的這類消息的填充:如何抑制MyFaces控制檯的html警告?
[3/26/13 16:42:33:744 CDT] 00000031 HtmlImageRend W Component UIGraphic Form:errorIconSave has no attribute alt or attribute resolves to null. Path to component {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /view/groupagreement/products/volumebased/VolumeBasedProducts.xhtml][Class: javax.faces.component.html.HtmlBody,Id: commonLayoutId][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id1364021679_785179b][Class: javax.faces.component.html.HtmlForm,Id: Form][Class: javax.faces.component.html.HtmlBody,Id: j_id363369746_1d362e8b][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id363369746_1d362e61][Class: org.richfaces.component.UIRegion,Id: j_id363369746_1d362e4a][Class: org.richfaces.component.UIPopupPanel,Id: confirmationPopUpForWayFinder][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id363369746_1d362ffd][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id363369746_1d362fbc][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id363369746_1d362f9a][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id363369746_1d362f70][Class: javax.faces.component.html.HtmlGraphicImage,Id: errorIconSave]}
[3/26/13 16:42:33:746 CDT] 00000031 HtmlResponseW W HTML nesting warning on closing div: element td rendered by component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /view/groupagreement/products/volumebased/VolumeBasedProducts.xhtml][Class: javax.faces.component.html.HtmlBody,Id: commonLayoutId][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id1364021679_785179b]} not explicitly closed
我們覺得這個過度砍伐可能損害性能。雖然我們知道我們應該將應用程序編碼爲html規範,但它是由離岸供應商提供的,我們對代碼的質量沒有太多的控制。此時我們可能沒有時間修復所有的xhtml文件(將alt屬性添加到圖像等)。
有沒有什麼辦法可以禁用這個日誌記錄?例如一個web.xml上下文參數?我在MyFaces文檔中找不到任何東西。
我應該注意到,我們使用的是SLF4J使用log4j的實現。爲了控制MyFaces日誌記錄,我們需要根據[這個myfaces問題]中的一些答案將java.util.logging重定向到slf4j(http://stackoverflow.com/questions/8012595/tomcat-logging-with- SLF4J-和log4j的)? – 2013-03-26 22:04:57
在進一步調查中,SLF4J的jul-to-slf4j橋看起來並不是我們想要的,因爲即使日誌記錄關閉,它也會影響性能。 (請參閱此處的[性能說明](http://www.slf4j.org/legacy.html#jul-to-slf4j)) – 2013-03-27 16:08:27