Hi everybody, i'm using JBoss 4.0.2 and my problem is i want to use in my web
app log4j over implementation of commons-logging Log4JLogger. So i created
log4j.properties file in WEB-INF/classes:
# Debug log4j
log4j.debug=true
log4j.rootLogger=debug, myapp
log4j.appender.myapp=org.apache.log4j.FileAppender
log4j.appender.myapp.layout=org.apache.log4j.HTMLLayout
log4j.appender.myapp.layout.LocationInfo=true
log4j.appender.myapp.layout.Title='All' Log
log4j.appender.myapp.File=myapp.html
log4j.appender.myapp.ImmediateFlush=true
log4j.appender.myapp.Append=false
In jboss-web.xml i added:
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
webtest:loader=webtest.war
<loader-repository-config>
java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
I put log4j-1.2.9.jar to WEB-INF/lib.
So what confuse me is when i use code like:
import org.apache.log4j.Logger;
...
Logger log=Logger.getLogger(TestServlet.class);
log.debug("testing");
everithing works fine, i get debug info from log4j how it configures logger and
log file myapp.html contains my "testing" message.
I need to use commons-logging so i use code like that:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
...
Log log=LogFactory.getLog(TestServlet.class);
log.debug("testing");
in this case no debug info, no log file myapp.html.?
when i try to force log4j reading log4j.properties like:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
...
PropertyConfigurator.configure(Thread.currentThread().getContextClassLoader().
getResource("log4j.properties"));
Log log=LogFactory.getLog(TestServlet.class);
log.debug("testing");
i got debug info from log4j, log file myapp.html was created, but was empty?
Thanks for any future reply.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929045#3929045
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929045
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user