Results 1 to 2 of 2
  1. #1
    holyjohn is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default Problem on Log4j: How to include custom <filter/> into JBoss (log4j.xml)?

    This works on normal Java Application.

    XML Code:
    <appender name="TRANS" class="org.apache.log4j.DailyRollingFileAppender">
                    <filter class="log4j.TransFilter"/>
        </appender>
    <appender name="TRANS" class="org.apache.log4j.DailyRollingFileAppender">
            <param name="File" value="C:/myLogFile.log"/>
            <param name="DatePattern" value="'.'yyyy-MM"/>
            <param name="Append" value="true"/>
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%m%n"/>
            </layout>
            <filter class="log4j.TransFilter"/>
    </appender>
    
    <root>
          <appender-ref ref="CONSOLE"/>
          <appender-ref ref="FILE"/>
         <appender-ref ref="TRANS"/>
    </root>
    But, this doesn't work on jboss 3.2.5
    XML Code:
    <appender name="TRANS" class="org.apache.log4j.DailyRollingFileAppender">
            <param name="File" value="${jboss.server.home.dir}/log/transaction.log"/>
            <param name="DatePattern" value="'.'yyyy-MM"/>
            <param name="Append" value="true"/>
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%m%n"/>
            </layout>
            <filter class="log4j.TransFilter"/>
        </appender>
    
    <root>
          <appender-ref ref="CONSOLE"/>
          <appender-ref ref="FILE"/>
         <appender-ref ref="TRANS"/>
    </root>
    Error occurred at server log file.
    Java Code:
    log4j:ERROR Could not instantiate class [log4j.TransFilter].
    java.lang.ClassNotFoundException: log4j.TransFilter
            at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:141)
            at org.apache.log4j.helpers.Loader.loadClass(Loader.java:160)
            at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(Optio
    nConverter.java:309)
            at org.apache.log4j.xml.DOMConfigurator.parseFilters(DOMConfigurator.jav
    a:269)
            at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
    va:190)
            at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
    or.java:140)
            at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
    gurator.java:153)
            at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
    Configurator.java:415)
            at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:3
    84)
            at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783)
            at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
    :666)
            at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
    :616)
            at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
    :602)
            at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:6
    97)
            at org.jboss.logging.Log4jService$URLWatchTimerTask.reconfigure(Log4jSer
    vice.java:624)
            at org.jboss.logging.Log4jService$URLWatchTimerTask.run(Log4jService.jav
    a:563)
            at org.jboss.logging.Log4jService.setup(Log4jService.java:450)
            at org.jboss.logging.Log4jService.createService(Log4jService.java:466)

  2. #2
    holyjohn is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default

    TransFilter is a custom filter that I have created, a .java file.

Similar Threads

  1. Another log4j problem
    By lowlyintern in forum Advanced Java
    Replies: 1
    Last Post: 06-18-2010, 01:31 PM
  2. problem with log4j
    By neha.shri in forum New To Java
    Replies: 1
    Last Post: 06-26-2009, 09:30 AM
  3. Log4j problem - Logs are rolling into the previous date file
    By vaibhavborole in forum Advanced Java
    Replies: 0
    Last Post: 04-16-2009, 03:33 PM
  4. log4j problem.
    By dheerajsea123 in forum Advanced Java
    Replies: 1
    Last Post: 12-10-2008, 08:33 AM
  5. Log4J, problem with Hibernate and Spring
    By Marcus in forum Advanced Java
    Replies: 1
    Last Post: 06-06-2007, 03:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •