> I was wondering if anyone had experience initilizing their properity
> configurators. I code that looks like:
>
> private static final String logFile = "c://xmlparser.properties";
>
> static {
> try {
> //read config for log4j webct logging
> PropertyConfigurator.configureAndWatch(logFile);
> _category = Category.getRoot();
> _category.log(Priority.WARN, "XmlParser");
> } catch (Exception e) {
> e.printStackTrace();
> }
>
>
> What I am wondering is if I just tell it the name of the
> properties file,
> what directory does it look for it in? I need something that
> is relative
> to the location of the class loading it so that if multiple
> people check
> my soruce file out and they have different project directories on
> different drives then it would still find the properties file.
If you give a relative path, it will be relative to the working
directory of the JVM process, which is unrelated to where the classfiles
are. If you wish to use "class-relativity" you should load the
properties resource yourself, probably using
getClass().getResourceAsStream(file); (see javadoc for details) then use
PropertyConfigurator.configure(Properties).
Jon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]