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: 564
posted
0
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
posted
0
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: 564
posted
0
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
posted
0
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: 564
posted
0
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.