How to enable Log4j in struts

haiI am new to struts. I would like to use Log4j in struts. Can anyone tell me how to enable Log4j in struts, Please...Thanks in advance....
[161 byte] By [Thilagavathia] at [2007-11-27 7:58:59]
# 1
try this... http://www.mobilefish.com/developer/struts/struts_quickguide_log4j.htmland lemme know
@@CKM@@a at 2007-7-12 19:40:57 > top of Java-index,Java Essentials,Java Programming...
# 2
First of all you need to have a log4j.xml file in your class path, and change the default logger type to ALL. which enables the logger automatically
harish.suna at 2007-7-12 19:40:57 > top of Java-index,Java Essentials,Java Programming...
# 3
use your log4j.xml file to enable
sandeep_2012a at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...
# 4
haiGood Morning!....I have been placed log4j.xml under my WEB-INF and set CLASSPATH but I am not able to get logging messages on my console. Can u tell me where should I place log4j.xml file and what changes I have to do in my struts-config.xml.Thanks in advance...
Thilagavathia at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...
# 5
The WEB-INF/classes directory is in your classpath, so you can put the configuration file there. Messing with the CLASSPATH environment variable has no effect on your application server, so don't bother doing that.
DrClapa at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...
# 6

hai

still I am not getting output, can anyone help me, Please....

I have initialized log in my ActionServlet and also placed my log4j.properties and log4j.xml files under /WEB-INF/classes

--here is my code--

public class DemoAction extends Action

{

private Log log=LogFactory.getLog("DemoAction");

public ActionForward execute(ActionMapping mapping,Actionform form,...........)

{

.................

..............

..................

if(username==null&&password==null)

{

log.error("User has not Logged In");

}

else

log.error("User has LoggedIn in session");

}

return mapping.findForward("success");

}

}

here is my log4j.properties

log4j.rootLogger="ERROR",Console

log4j.appender.Console=org.apache.log4j.ConsoleAppender

log4j.appender.Console=org.apache.log4j.PatternLayout

log4j.appender.Console.layout.ConversionPattern=[%5p]%d{mm:ss}(%F:%M:%L)%n%m%n%n

here is my log4j.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE log4j:Configuration SYSTEM "log4j.dtd">

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

<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">

<layout class="org.apache.log4j.PatternLayout"/>

</appender>

<root>

<priority value="debug"/>

<appender-ref ref=ConsoleAppender"/>

</root>

</log4j:Configuration>

I have log4j-1.2.9.jar under /common/WEB-INF/lib and also under my /WEB-INF/lib.

Can anyone tell me where is my mistake,

and tell me what are all the changes i have to do,please................

Thanks in advance..........

Thilagavathia at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...
# 7
Hitry the followingprivate Log log=LogFactory.getLog("DemoAction.class");and also dont 4get to keep log4j.DTDRegards,JOE
JeeDevelopera at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...
# 8
haiI have got the output for Log4j in struts successfully!Thanks for your kind replies........RegardsThilak
Thilagavathia at 2007-7-12 19:40:58 > top of Java-index,Java Essentials,Java Programming...