• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

where did log file go?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
very very cool, Mat! It's now working. Thanks a lot!!!
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic