Meaningless Drivel is fun!
The moose likes Struts and the fly likes Struts Log Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Log" Watch "Struts Log" New topic

Struts Log

Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
I have downloaded the example-struts.WAR and deployed it in my local WSAD application Server and it is perfectly running .

I want to see the log for example there are so many logtrace and log.debug as follows .

if (log.isTraceEnabled()) {
log.trace(" Creating new RegistrationForm bean under key "
+ mapping.getAttribute());

Can any body help me how to see this log or where is the configuration setting for the log file so that aftre running the application I can see the log as well

Thanks in advance .
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Struts uses Apache commons logging, which is just a common API to get at many different underlying logging systems.

If you want to make the logging statements in the example work, just put log4j.jar in your WEB-INF/lib file, provide a file that defines appenders for the examples classes, and the logging statements will start outputting to those appenders. Apache Commons logging will sense the presence of log4j as your underlying logging system.

Consultant, Sima Solutions
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
Hi Thanks for the reply but still I am not able to run the same.
Here is what I have done so far

Added the log4j.jar WEB-INF/lib
created with following containts

log4j.rootLogger = debug , myAppender

log4j.appender.myAppender = org.apache.log4j.ConsoleAppender
#log4j.appender.myAppender = org.apache.log4j.FileAppender
#log4j.appender.myAppender.file = Log4j.Log

log4j.appender.myAppender.layout = org.apache.log4j.PatternLayout

Now what should next ... it is not working
I agree. Here's the link:
subject: Struts Log
It's not a secret anymore!