permaculture playing cards*
The moose likes Tomcat and the fly likes tomcat logger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat logger" Watch "tomcat logger" New topic
Author

tomcat logger

manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
I want to throw errors/exceptions to server's log file from jsp as well as java class files. How can I achieve it?
Thanks & Regards,


love your job and not your company;
...because you never know when your company will stop loving you!
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
ServletContext.log()
and you can get the servlet context from the session.


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Beth Barja
Greenhorn

Joined: Nov 02, 2001
Posts: 10
I need to do this also.
Could you show a code example of how to do this? How to instantiate the object, etc...
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
It really is very simple:
ServletContext context = session.getServletContext();
context.log("this gets logged to localhost_log.YYYYMMDD");
:roll:
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Why not to use the implicit object available in your jsp: application itself which is the ServletContext? :roll:
application.log("this gets logged to localhost_log.YYYYMMDD");
Which saves your one line of typing at least.
[ June 16, 2002: Message edited by: Roseanne Zhang ]
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat logger
 
Similar Threads
Cant use object from another class
The x900 effect ?
Posting to bump up my count...
Text box value is not being completely filled with request attribute
WA #1.....word association