logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Ng <nkm.ke...@live.com>
Subject Re: Problem on Log4j: How to include custom <filter/> into JBoss (log4j.xml)?
Date Tue, 21 Sep 2010 01:42:04 GMT

Thank you for replying...
I'm a newbie, can you further guide me in solving this problem?
Question:
1. How to configure child-first classloading for webapps?
2. How to place both my custom Filter **and** log4j.jar in WEB-INF/lib?

Kevin.


Jacob Kjome wrote:
> 
> It's pretty clear that your "log4j.TransFilter" is loaded by a ClassLoader
> that is
> a child of the ClassLoader that loads log4j.jar.  Your class must be
> loaded by the
> same, or parent, classloader to that of Log4j.
> 
> So, for instance, if Log4j is loaded from some global lib directory in
> JBoss, then
> you probably should place your custom Filter class/jar in that same
> directory, as
> it will definitely not be found if loaded from, for instance, WEB-INF/lib
> (unless
> you configure child-first classloading for webapps and place BOTH your
> custom
> Filter **and** log4j.jar in WEB-INF/lib).
> 
> 
> Jake
> 
> 
> On 9/20/2010 1:49 AM, Kevin Ng wrote:
>> TransFilter is a custom filter that I have created, a .java file. This
>> run fine as Java Application. When I tried to convert into JBoss log4j
>> and error occur. File located: ../server/default/conf/log4j.xml Error
>> occur: 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)
>> ------------------------------------------------------------------------
>> View this message in context: Problem on Log4j: How to include custom
>> into JBoss (log4j.xml)?
>> <http://old.nabble.com/Problem-on-Log4j%3A-How-to-include-custom-%3Cfilter-%3E-into-JBoss-%28log4j.xml%29--tp29756960p29756960.html>
>> Sent from the Log4j - Dev mailing list archive
>> <http://old.nabble.com/Log4j---Dev-f153.html> at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-on-Log4j%3A-How-to-include-custom-%3Cfilter-%3E-into-JBoss-%28log4j.xml%29--tp29756960p29765396.html
Sent from the Log4j - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message