Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where did log file go?

 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried to use log4j for logs. The following is my code:


How come after the servlet is invoked, no log file is generated. Also there is an error in stdout: log4j:WARN No appenders could be found for logger (c:/test.log).

How do I make it work?


Thanks,
Jenny
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Setting up log4j is a bit more complex than the example you have provided.
I suggest that you read this Log4j Short Manual. If you still need more then then post back and I (or someone else) can send you a short example. I don't have one here at the moment as I have just rebuilt the computer so I would need to spend the time to write one, so have a go first.

Mat
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Finished rebuilding the pc, so here is some code.

au.com.mattwill.listeners.WebAppContextListener.java


au.com.mattwill.servlets.HelloWorld.java


web.xml


log4j.properties


directory structure is
E:\Apache Software Foundation\Tomcat 5.0\ - this is where tomcat is installed (form heron I will call this $TomcatHome)
$TomcatHome\webapps\SCWCD\ - this is the webapp I am using (form heron I will call this $SCWCD)
$SCWCD\WEB-INF\clases\au\com\mattwill\listeners & $SCWCD\WEB-INF\clases\au\com\mattwill\servlets is where the classes are
web.xml in the normal place $SCWCD\WEB-INF\
(no suprises so far)

log4j.properties lives in $SCWCD\WEB-INF\

and the logfile produced is
E:/Apache Software Foundation/Tomcat 5.0/logs/scwcd.log

Hope this helps

Mat
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
very very cool, Mat! It's now working. Thanks a lot!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic