gpt4 book ai didi

java - 如何关闭 Icefaces 日志记录?

转载 作者:行者123 更新时间:2023-12-04 05:33:28 26 4
gpt4 key购买 nike

我需要关闭 Icefaces 日志记录。我添加了如下的记录器引用,但我无法关闭 Icefaces 记录。

    <!-- I added this to filter off icefaces logging -->
<logger name="org.icepush">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>
<!-- I added this to filter off icefaces logging -->
<logger name="org.icefaces">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>
<!-- I added this to filter off icefaces logging -->
<logger name="com.icesoft.faces.application.D2DViewHandler">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>

我使用 Tomcat 进行本地开发,使用 Weblogic 进行生产。

我的 log4j.xml :
    <?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<!-- BEGIN APPENDER: RollingFileAppender (HBAppender) -->
<appender class="org.apache.log4j.RollingFileAppender" name="HBAppender">
<param value="${bla.root}/WEB-INF/frameworks.log" name="File"/>
<param value="2" name="MaxBackupIndex"/>
<param value="512KB" name="MaxFileSize"/>
<layout class="org.apache.log4j.PatternLayout">
<param value="%d %p [%c] - %m%n" name="ConversionPattern"/>
</layout>
</appender>
<!-- BEGIN APPENDER: RollingFileAppender (JSFAppender) -->
<appender class="org.apache.log4j.RollingFileAppender" name="JSFAppender">
<param value="${bla.root}/WEB-INF/frameworks.log" name="File"/>
<param value="2" name="MaxBackupIndex"/>
<param value="512KB" name="MaxFileSize"/>
<layout class="org.apache.log4j.PatternLayout">
<param value="%d %p [%c] - %m%n" name="ConversionPattern"/>
</layout>
</appender>
<!-- BEGIN APPENDER: RollingFileAppender (rotator) -->
<appender class="org.apache.log4j.RollingFileAppender" name="rotator">
<param value="true" name="Append"/>
<param value="C:apache-tomcat-6.0.32LVSProjlogslvs.log" name="File"/>
<param value="5" name="MaxBackupIndex"/>
<param value="2048KB" name="MaxFileSize"/>
<layout class="org.apache.log4j.PatternLayout">
<param value="[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n" name="ConversionPattern"/>
</layout>
</appender>
<!-- BEGIN APPENDER: RollingFileAppender (SFAppender) -->
<appender class="org.apache.log4j.RollingFileAppender" name="SFAppender">
<param value="${bla.root}/WEB-INF/frameworks.log" name="File"/>
<param value="2" name="MaxBackupIndex"/>
<param value="512KB" name="MaxFileSize"/>
<layout class="org.apache.log4j.PatternLayout">
<param value="%d %p [%c] - %m%n" name="ConversionPattern"/>
</layout>
</appender>
<!-- BEGIN APPENDER: ConsoleAppender (stdout) -->
<appender class="org.apache.log4j.ConsoleAppender" name="stdout">
<layout class="org.apache.log4j.PatternLayout">
<param value="[%d{MMM dd HH:mm:ss}] %-5p (%F:%L) - %m%n" name="ConversionPattern"/>
</layout>
</appender>
<!-- BEGIN APPENDER: DailyRollingFileAppender (APPLICATION) -->
<appender class="org.apache.log4j.DailyRollingFileAppender" name="APPLICATION" >
<param name="File" value="pem.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %-17c{2} (%30F:%L) %3x - %m%n"/>
</layout>
</appender>
<!-- BEGIN APPENDER: DailyRollingFileAppender (AUDIT) -->
<appender class="org.apache.log4j.DailyRollingFileAppender" name="AUDIT" >
<param name="File" value="pem_audit.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] %c - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
</appender>
<!-- logger references -->
<logger name="org.apache">
<appender-ref ref="JSFAppender"/>
</logger>
<logger name="org.hibernate">
<level value="info" />
<appender-ref ref="HBAppender"/>
</logger>
<logger name="org.springframework">
<appender-ref ref="SFAppender"/>
</logger>
<!-- I added this to filter off icefaces logging -->
<logger name="org.icepush">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>
<!-- I added this to filter off icefaces logging -->
<logger name="org.icefaces">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>
<!-- I added this to filter off icefaces logging -->
<logger name="com.icesoft.faces.application.D2DViewHandler">
<level value="OFF"/>
<appender-ref ref="stdout"/>
</logger>
<!-- root -->
<root>
<level value="info"/>
<appender-ref ref="APPLICATION"/>
<appender-ref ref="AUDIT"/>
<appender-ref ref="stdout"/>
</root>
</log4j:configuration>

这是 Tomcat 服务器启动时的控制台日志。我想过滤掉与 Icefaces 相关的日志。
Sep 5, 2012 11:57:43 AM org.apache.catalina.core.AprLifecycleListener init    
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\IBM\SDP1\jdk\jre\bin;.;c:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Development\axis2-1.5.4/bin;C:\Program Files\Java\jdk1.6.0_23/bin;C:\Development\apache-ant-1.7.0\bin;c:\cygwin\bin;c:\adams\filenet\IDM;c:\adams\filenet\Shared;C:\Shared;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\pb5;c:\sql\binn;c:\sql\dll;C:\MSSQL\BINN\;C:\Program Files\Executive Software\Diskeeper;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Windows Imaging\;C:\Program Files\Rational\common;C:\Program Files\Rational\ClearCase\bin;Y:\wpo4;S:\public;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\VanDyke Software\Clients\
Sep 5, 2012 11:57:43 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MyProj' did not find a matching property.
Sep 5, 2012 11:57:43 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8081"]
Sep 5, 2012 11:57:43 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 5, 2012 11:57:43 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1499 ms
Sep 5, 2012 11:57:43 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 5, 2012 11:57:43 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.29
Sep 5, 2012 11:57:44 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.29\webapps\MyProj\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Sep 5, 2012 11:57:50 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-7.0.29/webapps/MyProj/WEB-INF/lib/slf4j-jcl-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-tomcat-7.0.29/webapps/MyProj/WEB-INF/lib/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[Sep 05 11:57:57] INFO (JCLLoggerAdapter.java:284) - Trying to find Dozer configuration file: dozer.properties
[Sep 05 11:57:57] WARN (JCLLoggerAdapter.java:379) - Dozer configuration file not found: dozer.properties. Using defaults for all Dozer global properties.
[Sep 05 11:57:57] INFO (JCLLoggerAdapter.java:307) - Initializing Dozer. Version: 5.3.2, Thread Name: localhost-startStop-1
[Sep 05 11:57:57] INFO (JCLLoggerAdapter.java:263) - Dozer JMX MBean [org.dozer.jmx:type=DozerStatisticsController] auto registered with the Platform MBean Server
[Sep 05 11:57:57] INFO (JCLLoggerAdapter.java:263) - Dozer JMX MBean [org.dozer.jmx:type=DozerAdminController] auto registered with the Platform MBean Server
[Sep 05 11:57:57] INFO (JCLLoggerAdapter.java:263) - Initializing a new instance of dozer bean mapper.
Sep 5, 2012 11:57:57 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.1 (FCS 20110408) for context '/MyProj'
Sep 5, 2012 11:57:58 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
Sep 5, 2012 11:57:58 AM org.icepush.servlet.MainServlet <init>
INFO:
ICEsoft Technologies Inc.
ICEpush 2.0.0
Build number: 1
Revision: 23556

Sep 5, 2012 11:58:16 AM org.icefaces.util.EnvConfig init
INFO: ICEfaces Configuration:
org.icefaces.render.auto: true [default]
org.icefaces.autoid: true [default]
org.icefaces.aria.enabled: true [default]
org.icefaces.blockUIOnSubmit: false [default]
org.icefaces.compressDOM: false [default]
org.icefaces.compressResources: true [default]
org.icefaces.connectionLostRedirectURI: null [default]
org.icefaces.deltaSubmit: false [default]
org.icefaces.lazyPush: true [default]
org.icefaces.sessionExpiredRedirectURI: null [default]
org.icefaces.standardFormSerialization: false [default]
org.icefaces.strictSessionTimeout: false [default]
org.icefaces.windowScopeExpiration = 1000 [default]
org.icefaces.mandatoryResourceConfiguration: null [default]
org.icefaces.uniqueResourceURLs: true [default]

Sep 5, 2012 11:58:16 AM org.icefaces.impl.renderkit.DOMRenderKit <clinit>
INFO:
ICEsoft Technologies Inc.
ICEfaces 2.0.0
Build number: 4
Revision: 23692

最佳答案

添加 commons-logging.propertiessrc包含内容的文件夹

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

每当它使用公共(public)日志记录时,它将使用 log4j。应该相应地配置 log4j 日志记录。确保将 log4j.jar 添加到类路径中。

但是, icefaces最终使用 java.util.logging记录器。你必须使用它的日志配置。为此,您需要添加 -Djava.util.logging.config.file=\path\to\logging.properties服务器启动配置的选项。

简单文件 logging.properties位于 JDK\JRE\lib 文件夹中。您可以使用它并添加
org.icepush.level = OFF
org.icefaces.level = OFF
javax.faces.level = OFF
com.sun.faces.level = OFF

到文件末尾。

如果您使用 Eclipse,则使用 Preferences -> Servers -> JDK -> Optional Java VM arguments:将此选项添加到服务器 JDK。或者,您可以创建服务器启动配置 Preferences -> Servers -> Launch -> Create Launch Configuration 并在此处定义此选项。您可以为同一服务器创建多个启动配置。最近,您可以通过指定服务器启动配置将此配置与应用程序运行配置映射。

关于java - 如何关闭 Icefaces 日志记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12286052/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com