Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to write to a log file within a JSP

795628Jan 8 2003 — edited Jan 8 2003
Hello everybody,

do you know how to write to a log file within a JSP.

my code is (/space/SP/tlf/ExcepcionJava.jsp):
<html>
<body bgColor=#C4E1FF>

<%@ page import="java.io.*" %>

<%
	FileWriter salida = new FileWriter(response.encodeURL("log.txt"));
	salida.write(request.getParameter("errorMsg"));
	salida.close();
%>

</body>
</html>
.. I run under Solaris, Jrun 2.3.3

I have also test with getServletContext().getRealPath(), but I get /netsrv/nes/docs/ instead of /space/SP/tlf/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 5 2003
Added on Jan 8 2003
1 comment
373 views