Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Log

 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic