Commit Graph

362 Commits

Author SHA1 Message Date
Gareth Jones
83271e47fc Merge pull request #125 from jimschubert/master
Allow for somewhat standard debugging calls
2013-03-24 19:35:24 -07:00
Jim Schubert
f3271a3997 Add standard debug conditional function
: master
2013-03-23 18:50:13 -07:00
Gareth Jones
4b7cf589a2 Fixing the wiki links (issue #124) 2013-03-20 19:47:32 +11:00
Gareth Jones
c8f401c47d fixed travis node version format 2013-03-20 14:58:56 +11:00
Gareth Jones
ecbf41bc83 updated readme with node 0.10 info 2013-03-20 09:16:42 +11:00
Gareth Jones
65e490cbd2 Fixes for version v0.10 streams, breaks log4js for older versions of node 2013-03-20 09:14:27 +11:00
Gareth Jones
f272e3fd0a Merge branch 'master' into util.format 2013-02-25 16:43:03 +11:00
Gareth Jones
5e242c9dc9 bumped version 2013-02-25 16:33:48 +11:00
Gareth Jones
50eefcc701 Merge pull request #116 from imkira/master
Pass options from multiprocess appender to inner appender
2013-02-24 21:30:42 -08:00
Mário Freitas
8e53c6213e fix: pass options from multiprocess appender to inner appender 2013-02-21 00:06:59 +09:00
Gareth Jones
a15a628311 Merge pull request #115 from NicolasPelletier/master
Speed up file logging for high rate of logging.
2013-02-14 16:32:03 -08:00
Nicolas Pelletier
b75e3660f4 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 09:35:02 -05:00
Gareth Jones
22da6226e5 Merge pull request #113 from bitcloud/patternLayout_tokens
add your own tokens to the patternLayout
2013-02-11 13:45:18 -08:00
Gareth Jones
c9a890b37b added some test output files to gitignore 2013-02-12 07:23:18 +11:00
Jan Schmidle
a3bdac8e14 updated require in example to match other examles 2013-02-08 16:22:29 +01:00
Jan Schmidle
af428c5669 added example on pattern tokens usage 2013-02-08 16:18:27 +01:00
Jan Schmidle
5c75ba9468 fixed small issue that could occur with wrong evaluated parameters 2013-02-08 16:17:24 +01:00
Jan Schmidle
bec0d05847 added some documentation to the function header 2013-02-08 16:15:51 +01:00
Jan Schmidle
e4bf405f20 add your own tokens to the patternLayout 2013-02-08 14:54:18 +01:00
Gareth Jones
95568f352b Merge pull request #110 from Dignifiedquire/fix-2
Move examples into their own directory.
2013-01-20 16:15:53 -08:00
Gareth Jones
6da6f3c90e Merge pull request #109 from Dignifiedquire/fix-1
Misc code highlighting fixes in readme.md
2013-01-20 14:16:04 -08:00
Friedel Ziegelmayer
7f57d14e70 Move examples into their own directory. 2013-01-19 22:14:14 +01:00
Friedel Ziegelmayer
f478793da3 Misc code highlighting fixes in readme.md 2013-01-19 22:09:31 +01:00
Gareth Jones
0dbc4921a3 Changed layouts to use util.format instead of my own implementation 2013-01-11 15:35:00 +11:00
Gareth Jones
ec2f8fec3b Merge pull request #105 from ulikoehler/readme-syntax-highlighting
Added syntax highlighting to JS code in README.md
2013-01-06 13:33:52 -08:00
Uli Köhler
0167c84ea5 Added syntax highlighting to JS code in README.md 2013-01-06 01:09:55 +01:00
Gareth Jones
3e1a27e522 New version, with colours in pattern layout 2012-12-03 09:59:36 +11:00
Gareth Jones
8b42e46071 Merge pull request #101 from Dignifiedquire/feature-color-pattern
[feature] Add patternColoured Layout.
2012-12-02 14:51:27 -08:00
Friedel Ziegelmayer
4a7a90ed53 [feature] Add color option to pattern layout.
Based on #90 this implements the possibillity to add the color codes
according to the log level via %[ and %].
2012-12-02 23:41:59 +01:00
Gareth Jones
a9307fd6da fix for issue #100, multiprocess appender and logLevelFilter don't play nicely 2012-11-09 16:02:16 +11:00
Gareth Jones
4739c65c68 Version 0.5.4 2012-10-16 11:54:21 +11:00
Gareth Jones
892181f88f Merge pull request #98 from danbell/master
Check environment variable LOG4JS_CONFIG for configuration file location.
2012-10-15 17:52:08 -07:00
Daniel Bell
bdfa7f9a9b Delete LOG4JS_CONFIG environment variable after test has finished. 2012-10-16 10:55:30 +11:00
Daniel Bell
ad63b801f7 Check environment variable LOG4JS_CONFIG for configuration file location. 2012-10-16 08:36:26 +11:00
Gareth Jones
2bfad6362a Version 0.5.3 2012-09-26 09:49:58 +10:00
Gareth Jones
2b889fe776 Working date rolling file appender. 2012-09-25 08:16:59 +10:00
Gareth Jones
9ac61e37f4 Refactored where the exit handler gets added 2012-09-25 07:43:37 +10:00
Gareth Jones
185f343e68 Working date rolling file stream 2012-09-18 08:46:39 +10:00
Gareth Jones
be1272cd7c moved streams code around, added stub for DateRollingFileStream 2012-09-05 10:58:28 +10:00
Gareth Jones
cbc1dd32f9 fixed up some dodgy tabbing 2012-09-05 08:00:31 +10:00
Gareth Jones
a6fb26efb1 Removed mentions of pollInterval (issue #93) 2012-09-04 13:48:35 +10:00
Gareth Jones
012b0d5ed7 version 0.5.2 2012-08-14 10:47:25 +10:00
Gareth Jones
de72005e7e Fixed layout stack trace test 2012-08-14 09:44:43 +10:00
Gareth Jones
c6a0e58409 Merge pull request #89 from ixti/master
Fix possible memleak with `exit` event handlers
2012-08-13 16:32:08 -07:00
Aleksey V Zapparov
f832a2ba79 Do not assign multiple exit handlers for FA 2012-08-09 15:21:30 +02:00
Aleksey V Zapparov
3f10b68c30 Add test for amount of exit listeners in FA 2012-08-09 15:15:28 +02:00
Gareth Jones
54c311842c Merge pull request #86 from osher/patch-3
Update lib/layouts.js
2012-08-01 16:21:01 -07:00
osher
f948b5f5cd Add unit tests - layouts-test.js 2012-08-01 10:11:37 +03:00
osher
54e420eb58 Update lib/layouts.js
Errors sometimes carry additional attributes on them as part of the passed error data.
A utility that utilizes it, for example - is called 'errs', which is in use for instance 'nano' - the couch-db driver.

when only the stack is printed - all the additional information that is augmented on the error object does not sink to the log and is lost.

consider the following code:

```
//the oups throwing utility
function oups(){
  e = new Error();
  extend(
    { message    : "Oups error"
    , description: "huston, we got a problem"
    , status     : "MESS"
    , errorCode  : 991
    , arr :[1,2,3,4,{}]
    , data: 
      { c:{}
      , d:{e:{}}
      }
    }
  throw e;
}

var log = require('log4js')

try{
  oups()
} catch( e ) {
   log.error("error on oups", e );
}

```


output before the fix

```
error on oups Error: Oups error
    at repl:1:11
    at REPLServer.eval (repl.js:80:21)
    at Interface.<anonymous> (repl.js:182:12)
    at Interface.emit (events.js:67:17)
    at Interface._onLine (readline.js:162:10)
    at Interface._line (readline.js:426:8)
    at Interface._ttyWrite (readline.js:603:14)
    at ReadStream.<anonymous> (readline.js:82:12)
    at ReadStream.emit (events.js:88:20)
```


output after the fix would be

```
error on oups { [Error: My error message]
  name: 'Error',
  description: 'huston, we got a problem',
  status: 'MESS',
  errorCode: 991,
  arr: [ 1, 2, 3, 4, {} ],
  data: { c: {}, d: { e: {} } } }
Error: Oups error
    at repl:1:11
    at REPLServer.eval (repl.js:80:21)
    at Interface.<anonymous> (repl.js:182:12)
    at Interface.emit (events.js:67:17)
    at Interface._onLine (readline.js:162:10)
    at Interface._line (readline.js:426:8)
    at Interface._ttyWrite (readline.js:603:14)
    at ReadStream.<anonymous> (readline.js:82:12)
    at ReadStream.emit (events.js:88:20)
```
2012-07-31 14:32:03 +03:00
Gareth Jones
40ba24a55d Renamed tests so that vows will pick them up automatically 2012-07-31 14:52:36 +10:00