2010-01-17 09:08:28 +08:00
|
|
|
{
|
2010-08-10 19:56:10 +08:00
|
|
|
"name": "log4js",
|
2013-03-20 06:14:27 +08:00
|
|
|
"version": "0.6.0",
|
2010-01-17 09:08:28 +08:00
|
|
|
"description": "Port of Log4js to work with node.",
|
|
|
|
"keywords": [
|
|
|
|
"logging",
|
|
|
|
"log",
|
|
|
|
"log4j",
|
2011-10-27 09:38:13 +08:00
|
|
|
"node"
|
2010-01-17 09:08:28 +08:00
|
|
|
],
|
2010-08-10 19:56:10 +08:00
|
|
|
"main": "./lib/log4js",
|
|
|
|
"author": "Gareth Jones <gareth.jones@sensis.com.au>",
|
2012-02-22 11:37:45 +08:00
|
|
|
"repository": {
|
|
|
|
"type": "git",
|
|
|
|
"url": "https://github.com/nomiddlename/log4js-node.git"
|
|
|
|
},
|
2010-01-17 09:08:28 +08:00
|
|
|
"bugs": {
|
2012-02-22 11:37:45 +08:00
|
|
|
"url": "http://github.com/nomiddlename/log4js-node/issues"
|
2010-01-17 09:08:28 +08:00
|
|
|
},
|
2013-03-20 06:14:27 +08:00
|
|
|
"engines": [ "node >=0.10" ],
|
2010-01-17 09:08:28 +08:00
|
|
|
"scripts": {
|
2012-07-31 12:52:36 +08:00
|
|
|
"test": "vows"
|
2010-01-17 09:08:28 +08:00
|
|
|
},
|
|
|
|
"directories": {
|
2010-12-06 17:42:14 +08:00
|
|
|
"test": "test",
|
|
|
|
"lib": "lib"
|
2011-04-17 15:29:22 +08:00
|
|
|
},
|
2011-10-27 09:38:13 +08:00
|
|
|
"dependencies": {
|
Speed up file logging for high rate of logging.
During an evaluation of multiple loggers, I saw a slow down when trying to
quickly log more than 100,000 messages to a file:
```javascript
counter = 150000;
while (counter) {
logger.info('Message[' + counter + ']');
counter -= 1;
}
```
My detailed test can be found here:
- https://gist.github.com/NicolasPelletier/4773843
The test demonstrate that writing 150,000 lines straight in a FileStream
takes about 22 seconds until the file content stabilizes. When calling
logger.debug() 150,000 times, the file stabilizes to its final content
after 229s ( almost 4 minutes ! ).
After investigation, it turns out that the problem is using an Array() to
accumulate the data. Pushing the data in the Array with Array.push() is
quick, but the code flushing the buffer uses Array.shift(), which forces
re-indexing of all 149,999 elements remaining in the Array. This is
exponentially slower as the buffer grows.
The solution is to use something else than an Array to accumulate the
messages. The fix was made using a package called Dequeue
( https://github.com/lleo/node-dequeue ). By replacing the Array with
a Dequeue object, it brought the logging of 150,000 messages back down to
31s. Seven times faster than the previous 229s.
There is a caveat that each log event is slightly longer due to the need
to create an object to put in the double-ended queue inside the Dequeue
object. According to a quick test, it takes about 4% more time per call
to logger.debug().
2013-02-13 22:35:02 +08:00
|
|
|
"async": "0.1.15",
|
|
|
|
"dequeue": "1.0.3"
|
2011-10-27 09:38:13 +08:00
|
|
|
},
|
2011-04-17 15:29:22 +08:00
|
|
|
"devDependencies": {
|
2013-03-20 06:14:27 +08:00
|
|
|
"vows": "0.7.0",
|
2012-03-22 06:34:41 +08:00
|
|
|
"sandboxed-module": "0.1.3",
|
2012-05-29 14:59:26 +08:00
|
|
|
"hook.io": "0.8.10",
|
2011-11-03 06:10:02 +08:00
|
|
|
"underscore": "1.2.1"
|
2011-10-27 09:38:13 +08:00
|
|
|
}
|
2010-01-17 09:08:28 +08:00
|
|
|
}
|