fixed to work with node 0.5.x

This commit is contained in:
Gareth Jones
2011-09-15 08:13:04 +10:00
parent 53a481d4da
commit 12e71bda4e
4 changed files with 18 additions and 37 deletions

View File

@@ -249,22 +249,15 @@ function getDefaultLogger () {
}
function findConfiguration() {
//add current directory onto the list of configPaths
var paths = ['.'].concat(require.paths);
//add this module's directory to the end of the list, so that we pick up the default config
paths.push(__dirname);
var pathsWithConfig = paths.filter( function (pathToCheck) {
try {
fs.statSync(path.join(pathToCheck, "log4js.json"));
return true;
} catch (e) {
return false;
}
});
if (pathsWithConfig.length > 0) {
return path.join(pathsWithConfig[0], 'log4js.json');
var path;
try {
path = require.resolve('log4js.json');
} catch (e) {
//file not found. default to the one in the log4js module.
path = __dirname + '/log4js.json';
}
return undefined;
return path;
}
function loadConfigurationFile(filename) {