我们正在准备将我们的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