From 5b964c0958238cdeaf2f17eb4e183aaf77b60b24 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 21 Jan 2011 19:15:40 +0100 Subject: log level configuration --- src/nodejs/no1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nodejs/no1.js b/src/nodejs/no1.js index 37e106d..631b92c 100644 --- a/src/nodejs/no1.js +++ b/src/nodejs/no1.js @@ -20,7 +20,7 @@ var log4js = require('log4js')(); //note the need to call the function //log4js.addAppender(log4js.fileAppender('osm-xapi.log'), 'cheese'); var log = log4js.getLogger('global'); -log.setLevel('ALL'); +log.setLevel(config['logLevel']); log.info("server starting..."); -- cgit v1.2.3 From 10457418fef0b9dcc3881a081c20d1a16576e738 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 21 Jan 2011 19:16:00 +0100 Subject: fixed error message, if no db connection is available --- src/nodejs/no1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nodejs/no1.js b/src/nodejs/no1.js index 631b92c..7895cff 100644 --- a/src/nodejs/no1.js +++ b/src/nodejs/no1.js @@ -119,8 +119,8 @@ function connectionError(err, res) { function db_connect(res, callback) { pg.connect(connectionString, function(err, client) { if(err) { - log.error('message'); - res.writeHead(404,{}); + log.error(err.message); + res.writeHead(500,{}); res.end(); } else { log.info("db connection was successfull"); -- cgit v1.2.3 From ef40dfbef99938969de07fe82c8bffbb67303faf Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 21 Jan 2011 19:23:48 +0100 Subject: adding log level (cont.) --- src/nodejs/config.json | 1 + src/nodejs/xmlGenerator.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nodejs/config.json b/src/nodejs/config.json index 9c18203..be796a7 100644 --- a/src/nodejs/config.json +++ b/src/nodejs/config.json @@ -1,3 +1,4 @@ exports.connectionString = "pg://user:password@host/database"; exports.host = 'localhost'; exports.port = 8080; +exports.logLevel = 'ERROR'; diff --git a/src/nodejs/xmlGenerator.js b/src/nodejs/xmlGenerator.js index e982e18..97cd2ae 100644 --- a/src/nodejs/xmlGenerator.js +++ b/src/nodejs/xmlGenerator.js @@ -1,10 +1,12 @@ +var config = require('./config.json'); + var builder = require('xmlbuilder'); //set up logger var log4js = require('log4js')(); //note the need to call the function //log4js.addAppender(log4js.fileAppender('osm-xapi.log'), 'cheese'); var log = log4js.getLogger('xmlGenerator'); -log.setLevel('ALL'); +log.setLevel(config.logLevel); exports.createNode = function (row) { -- cgit v1.2.3 From 07da9786719a93a019288367438aa9131af8a8e0 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 21 Jan 2011 19:24:40 +0100 Subject: changed dict access to dot access --- src/nodejs/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nodejs/main.js b/src/nodejs/main.js index 7895cff..71667af 100644 --- a/src/nodejs/main.js +++ b/src/nodejs/main.js @@ -13,14 +13,14 @@ process.argv.forEach(function (val,index, array){ config = require(path); } }); -var connectionString = config['connectionString']; +var connectionString = config.connectionString; //set up logger var log4js = require('log4js')(); //note the need to call the function //log4js.addAppender(log4js.fileAppender('osm-xapi.log'), 'cheese'); var log = log4js.getLogger('global'); -log.setLevel(config['logLevel']); +log.setLevel(config.logLevel); log.info("server starting..."); -- cgit v1.2.3