Commit 52594a82 authored by priit's avatar priit
Browse files

Error reporting

parent 5285482b
......@@ -8,6 +8,43 @@ config.redis = {
port: 6379
};
config.log4js = {
appenders: [
{ type: 'console',
layout: {
type: 'pattern',
pattern: "[%d] %[[%x{pid}] [%5.5p]%] %c - %m",
tokens: {
pid: process.pid
}
}
},
{ type: 'file',
filename: __dirname + 'keeleliin-server.log'
},
{
"type": "logLevelFilter",
"level": "ERROR",
"appender": {
"type": "smtp",
"recipients": "**********",
"sendInterval": 10, //sec
"transport": "SMTP",
"SMTP": {
"host": "smtp.gmail.com",
"secureConnection": false,
"port": 587,
"auth": {
"user": "***********",
"pass": "***********"
},
"debug": true
}
}
}
]
};
config.serviceTypes = {
LOCAL: 'LOCAL'
};
......
......@@ -60,6 +60,17 @@ var CleanerService = function () {
var filePath = folder + '/' + file;
logger.debug(filePath);
fs.stat(filePath, function(err, stat) {
if(err){
logger.error(filePath);
logger.error(err);
return continueScan();
}
if(stat == undefined){
logger.error('Stat is undefined for: ' + filePath);
return continueScan();
}
if (stat.isDirectory()) {
var timeModified = stat.mtime.getTime();
var currentTime = new Date().getTime();
......@@ -71,13 +82,13 @@ var CleanerService = function () {
} else {
logger.debug('Session delete success: ' + file);
}
continueScan();
return continueScan();
});
} else {
continueScan();
return continueScan();
}
} else {
continueScan();
return continueScan();
}
});
}
......
......@@ -30,22 +30,9 @@ app.set('views', path.join(__base, 'views'));// view engine setup
app.set('view engine', 'jade');// view engine setup
app.use(express.static(__base + '/public'));
log4js.configure({
appenders: [
{ type: 'console',
layout: {
type: 'pattern',
pattern: "[%d] %[[%x{pid}] [%5.5p]%] %c - %m",
tokens: {
pid: process.pid
}
}
},
{ type: 'file', filename: 'keeleliin.log' }
]
});
var log4jsLogger = log4js.getLogger('app_js');
log4js.configure(config.log4js);
var log4jsLogger = log4js.getLogger('wrapper_server_js');
app.use(logger('dev'));
app.use(bodyParser.json({limit: '1000mb'})); // for parsing application/json
app.use(multer({ dest: config.service.staticParams.tmpPath})); // for parsing multipart/form-data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment