You could directly specify where you want your log files to be stored.
ServletContext context = getServletContext();
// Returns a String containing the real path for a given virtual path.
String strPath = context.getRealPath("DirectoryName");
This path you shall get irrespective of where you deploy your application,
and which path.
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1059
-----Original Message-----
From: Jan Aren� [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 7:28 AM
To: [EMAIL PROTECTED]
Subject: Logfile directory
Hi
I have a LogFile Class that writes a specific log if I set a debug variable
to true.
When I compile it at my local mashine (JDeveloper) it is written to the
basedirectory of the classes. But when I upload them to the apache webserver
(Oracles default web/jspserver) it writes the log to the winnt\system32
directory.
How do I force it to write to a specific directory based on the class file
(example a log directory under the directory that the Logger.class is placed
in)?
Code
FileOutputStream fos = null;
try
{
File f = new File(pFile);
if(!f.exists())
{
fos = new FileOutputStream(f);
}
else
{
fos = new FileOutputStream(pFile, true);
}
pText += "\n";
fos.write( (new Date( System.currentTimeMillis() ).toString() + " :
["+ pFunction +"] " + pText).getBytes() );
}
catch(Exception e) { /* Do nothing */ }
finally
{
try
{
fos.close();
}
catch(Exception e) { /* Do nothing */ }
}
Thanks for any help
Jan Aren�
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
==========================================================================To
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com