You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2002/11/01 21:15:48 UTC

Re[2]: Specifying default configuration file for Tomcat

Hello Yoav,

That implies loading it via a File object which is not guaranteed to
work in a servlet environment because you can't control whether your
app is loaded off the filesystem or directly from a .war file.  Load
it as a resource, not as a file.

InputStream stream = this.getClass().getResourceAsStream("foo.txt");

Or, just store it in WEB-INF and do:

InputStream is = getServletContext().getResourceAsStream("/WEB-INF/foo.txt");


That is portable in *all* cases.

Jake

Friday, November 01, 2002, 12:34:50 PM, you wrote:

SY> Hi,
SY> You're specifying the path to a file.  Use the File.separator for your
SY> system.  On Unix, that / normally, and on windows \.  

SY> Yoav Shapira
SY> Millennium ChemInformatics


>>-----Original Message-----
>>From: Bradley M. Handy [mailto:bhandy@arbor.edu]
>>Sent: Friday, November 01, 2002 1:36 PM
>>To: log4j-user@jakarta.apache.org
>>Subject: Specifying default configuration file for Tomcat
>>
>>I've read the short manual, and I've seen how to specify the default
>>configuration file when starting Tomcat.  However, I was wondering if
SY> my
>>configuration file is a couple of directory levels down from "WEB-
>>INF/classes", which notation should I use:
>>
>>       Dot notation:   "dir1.dir2.config-file.properties"
>>       Slash notation: "dir/dir2/config-file.properties" (Unix)
>>"dir1\dir2\config-file.properties" (Windows)
>>
>>Could someone please enlighten me?
>>
>>Thanks.
>>
>>Bradley M. Handy
>>Programmer/Analyst
>>Spring Arbor University
>>
>>mailto:bhandy@arbor.edu
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:log4j-user-
>>unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:log4j-user-
>>help@jakarta.apache.org>




-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>