Search code examples
javajsflog4jicefacesslf4j

How to turn off Icefaces logging?


I have a requirement to turn off Icefaces logging. I have added logger references as below but I could not turn off the Icefaces logging.

    <!-- 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> 

I am using Tomcat for local development and Weblogic for production.

My 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>

Here is console logs on tomcat server startup. I would like to filter off Icefaces related logs.

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

Solution

  • I found couple of ways to suppress the Icefaces logs. I am listing all of them below with pro and cons. I went with option 2.

    1) Editing logging.properties in jdk

    PROS: Quick and easy change, do not need to make any other changes and does not affect existing logging configuration, all classes that need to be suppressed can be placed in one location. CONS: Global change, all apps using this jdk are impacted by this change.

    2) Loading a separate log4j.xml to classpath on server startup and suppress Icefaces logs from there.

    PROS: WLS can remain on JDK logging. CONS: Global change, involve some configuration.

    3) Enabling log4j on WLS and loading log4j.xml to classpath on server startup.

    PROS: All logging (WLS and individual apps) will be on log4j. We can use the server level log4j.xml just for things we want for all apps, like disabling Icefaces logging and we can have another log4j file inside app to tell this app how to log with log4j. CONS: Involves configuring WLS to use log4j, a separate global log4j file needs to be maintained.