mwomack 2003/03/10 20:18:34 Modified: src/java/org/apache/log4j/chainsaw Start.java Log: Added a LocalDirectoryFinder to the FinderStrategies, after ResourceLoaderFinder, but before FileOpenFinder. It looks for the config file in the current directory. Revision Changes Path 1.3 +21 -0 jakarta-log4j/src/java/org/apache/log4j/chainsaw/Start.java Index: Start.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/Start.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Start.java 11 Mar 2003 03:59:20 -0000 1.2 +++ Start.java 11 Mar 2003 04:18:34 -0000 1.3 @@ -89,6 +89,7 @@ public FinderStrategies() { mStrategies.add(new ResourceLoaderFinder()); + mStrategies.add(new CurrentDirectoryFinder()); mStrategies.add(new FileOpenFinder()); // TODO: add any more stategies @@ -118,6 +119,26 @@ private static class ResourceLoaderFinder implements Log4JConfigurationFinder { public URL findConfiguration() { return this.getClass().getClassLoader().getResource(LOG4J_CONFIG_FILE); + } + } + + /** + * Finds the config file by looking for it in the current directory + * @author Mark Womack + * @version 1.0 + */ + private static class CurrentDirectoryFinder implements Log4JConfigurationFinder { + public URL findConfiguration() { + File configFile = new File("./" + LOG4J_CONFIG_FILE); + if (configFile.exists()) { + try { + return new URL("file:" + LOG4J_CONFIG_FILE); + } catch (Exception e) { + return null; + } + } else { + return null; + } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]