aspose file tools*
The moose likes JSP and the fly likes JSP and Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and Files" Watch "JSP and Files" New topic
Author

JSP and Files

Baba Bizlowsky
Ranch Hand

Joined: Dec 15, 2003
Posts: 39
Hi. Me again.

My JSP page has to log something in the file. For that purpose I have created a custom MyLogger class which has a static logging method. It receives a string, a name it should use for the file and it should create a file and put the string with logging info in it.

This MyLogger class, of course, resides in a WEB-INF/classes directory.

Upon testing it, however, I saw that the file gets created inside %TOMCAT_ROOT%/bin directory. Why? I thought that it would be created in an approppriate webapp directory, not there of all places...

How should I handle this?

Thanks in advance. Cheers!
Lavern Matthew
Ranch Hand

Joined: Jun 05, 2004
Posts: 38
the TOMCAT_HOME/bin is the current working directory. Take a look at
ServletContext.getRealPath(java.lang.String)


Matthew Wilson<br />-http://valuelist.sourceforge.net
Lavern Matthew
Ranch Hand

Joined: Jun 05, 2004
Posts: 38
Or better yet: http://javaboutique.internet.com/articles/LogwithJSP/
 
jQuery in Action, 2nd edition
 
subject: JSP and Files