This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Log" Watch "Struts Log" New topic
Author

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 log4j.properties 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.


Merrill
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 log4j.properties with following containts

#Logger
log4j.rootLogger = debug , myAppender

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

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

Now what should next ... it is not working
 
Don't get me started about those stupid light bulbs.
 
subject: Struts Log