Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / log4js / examples / flush-on-exit.js
1 /**
2  * run this, then "ab -c 10 -n 100 localhost:4444/" to test (in
3  * another shell)
4  */
5 var log4js = require('../lib/log4js');
6 log4js.configure({
7       appenders: [
8         { type: 'file', filename: 'cheese.log', category: 'cheese' },
9         { type: 'console'}
10   ]
11 });
12
13 var logger = log4js.getLogger('cheese');
14 logger.setLevel('INFO');
15
16 var http=require('http');
17
18 var server = http.createServer(function(request, response){
19     response.writeHead(200, {'Content-Type': 'text/plain'});
20     var rd = Math.random() * 50;
21     logger.info("hello " + rd);
22     response.write('hello ');
23     if (Math.floor(rd) == 30){
24         log4js.shutdown(function() { process.exit(1); });
25     }
26     response.end();
27 }).listen(4444);