Commit Graph

256 Commits

Author SHA1 Message Date
Gareth Jones
652888944b improved coverage for date_format 2013-06-17 16:00:42 +10:00
Gareth Jones
efc4e36317 improved coverage for layouts 2013-06-14 08:13:16 +10:00
Gareth Jones
dd25d30228 rolled back my clever map+join, because it broke the tests 2013-06-06 07:53:22 +10:00
Gareth Jones
11fe5bde5f increased test coverage for smtp appender 2013-06-05 18:30:11 +10:00
Gareth Jones
41ddf5eea7 merged util.format branch (fixes a lint error and simplifies the code) 2013-06-05 08:52:07 +10:00
Gareth Jones
81fa9c3568 removed unnecessary argument to createNoLogCondition 2013-06-05 08:38:39 +10:00
Gareth Jones
7ca517b5ed simplified createNoLogCondition 2013-06-05 08:37:27 +10:00
Gareth Jones
6368de1094 refactored pattern layout 2013-06-05 08:02:10 +10:00
Gareth Jones
94dbd22c71 reduced complex function to smaller ones 2013-06-04 08:37:36 +10:00
Gareth Jones
5d6f00eda4 fixed all lint errors except ones which require refactoring of code 2013-06-04 08:17:36 +10:00
Gareth Jones
f998d7e81a more linting 2013-05-30 08:45:15 +10:00
Gareth Jones
46ae1a586d more linting 2013-05-30 08:26:26 +10:00
Gareth Jones
516320c79a more linting 2013-05-30 08:26:03 +10:00
Gareth Jones
40ec9e98e4 more linting 2013-05-30 08:00:04 +10:00
Gareth Jones
cc2e94cf11 more linting 2013-05-30 07:58:09 +10:00
Gareth Jones
2de838bc76 more linting 2013-05-30 07:56:28 +10:00
Gareth Jones
b356dec318 Getting my lint on (via bob) 2013-05-25 14:00:06 +10:00
Gareth Jones
8492519e3b Fixing issue #137 2013-05-25 13:04:48 +10:00
Gareth Jones
ab8c7ed89d Merge pull request #136 from issacg/dontalwaysrename-bug
Dontalwaysrename bug
2013-05-15 23:52:57 -07:00
Issac Goldstand
dc632f4705 Fixes bug introduced in github issue #132 where file rolling needs to be handled differently for alwaysIncludePattern streams 2013-05-11 23:01:28 +03:00
Jure Mav
ac6284add1 Added automatic level detection to connect-logger, depends on http status response.
Update of connect logger example code, compatible with express 3.x
2013-05-11 16:17:23 +02:00
Issac Goldstand
2da01cc611 Fixes bug introduced in github issue #132 where renaming a file to itself can cause an unhandled error 2013-05-09 13:09:59 +03:00
Issac Goldstand
8c12c948d9 Fixes bug in detecting empty options (see issue #132 on github) 2013-05-08 12:05:32 +03:00
Gareth Jones
936ad4da8e fixed tests broken by alwaysIncludePattern 2013-05-05 13:44:01 +10:00
Gareth Jones
097ae3d7f1 Merge branch 'alwaysIncludePattern' of https://github.com/issacg/log4js-node into isaacg-alwaysIncludePattern 2013-05-04 16:10:02 +10:00
Issac Goldstand
29b02921b6 add option alwaysIncludePattern to dateTime appender to always use the filename with the pattern included when logging 2013-05-02 14:56:33 +03:00
Gareth Jones
ed7462885f backporting new streams to node 0.8 for issue #129 2013-04-11 21:45:16 +10:00
Gary Steven
e58cf201ca Updated for Node 0.10.x
net.createServer no longer emits 'connect' event
2013-03-30 03:23:58 -07:00
Jim Schubert
f3271a3997 Add standard debug conditional function
: master
2013-03-23 18:50:13 -07: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
Nick Howes
eb21e10208 Category excluding filter.
This filtering appender allows you to choose some category
names that won't be logged to the delegated appender. This
is useful if you have e.g. a category that you use to log
web requests to one file, but want to keep those entries
out of the main log file without having to explicitly list
all the other categories that you _do_ want to include.

Has one option, "exclude", which is a category name or
array of category names. The child appender is set in
"appender", modelled on the logLevelFilter.
2013-02-26 13:27:07 +00:00
Gareth Jones
f272e3fd0a Merge branch 'master' into util.format 2013-02-25 16:43:03 +11:00
Mário Freitas
8e53c6213e fix: pass options from multiprocess appender to inner appender 2013-02-21 00:06:59 +09: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
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
0dbc4921a3 Changed layouts to use util.format instead of my own implementation 2013-01-11 15:35:00 +11: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
Daniel Bell
ad63b801f7 Check environment variable LOG4JS_CONFIG for configuration file location. 2012-10-16 08:36:26 +11: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
Aleksey V Zapparov
f832a2ba79 Do not assign multiple exit handlers for FA 2012-08-09 15:21:30 +02: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
7a02f39921 Fallback to \n if os.EOL is not defined 2012-07-04 09:25:08 +10:00
Gareth Jones
b6ba3bce00 Merge branch 'master' of https://github.com/nomiddlename/log4js-node 2012-07-04 09:11:07 +10:00
Gareth Jones
638ce187bb use os.EOL instead of \n 2012-07-04 08:53:09 +10:00
Gareth Jones
a33e48cb07 Changed multiprocess appender to use a single socket per client 2012-07-04 08:44:50 +10:00
druciak
077302c772 SMTP appender migrated to nodemailer 0.3.x 2012-06-27 18:00:32 +02:00
Gareth Jones
a046523804 Moved Logger into separate file, added support for loading appenders outside log4js, removed 'name' from appender requirements 2012-06-01 11:11:07 +10:00
Gareth Jones
0ed1a137d6 moved Logger class out of main module 2012-05-31 08:16:22 +10:00
Gareth Jones
33a92b5dd6 Removed some exports that are no longer needed 2012-05-31 08:07:45 +10:00
Gareth Jones
0901794b35 Moved abspath option checking into file appender, log4js options now passed to appenders 2012-05-31 07:50:01 +10:00
Gareth Jones
38a89dcf3d manually merged TooTallNate's pull request #62 2012-05-29 16:49:12 +10:00
Gareth Jones
754ac2c5ac changed config loading to be more predictable 2012-05-29 15:50:35 +10:00
Gareth Jones
61078e88ef fixed the nolog tests 2012-05-09 16:40:27 +10:00
Gareth Jones
613a077a61 fixed test-configureNoLevels 2012-05-09 16:31:01 +10:00
Gareth Jones
68d1c8fa07 Merge pull request #69 from NetDevLtd/feature/setLevelAsymmetry
setLevel vs isLevelEnabled asymmetry
2012-05-08 16:38:55 -07:00
Mike Bardzinski
872bc791c7 Fixes the log4js.configure({}) issue which zapped all loggers' levels to TRACE, even if they were previously set to something else 2012-05-02 16:10:20 +01:00
Mike Bardzinski
2c7b56853b Changed toLevel to accept a Log4js.Level (or in fact any object), and try to convert it to a Log4js.Level. Fixes the setLevel asymmetry, where you cannot setLevel(log4js.level.foo) 2012-05-02 15:41:32 +01:00
Gareth Jones
1fb8962b83 turned off debug in streams (issue #63) 2012-03-20 09:39:15 +11:00
Gareth Jones
e78f4e33ce Fixed issue #51, added tests to cover levels 2012-02-22 14:14:46 +11:00
Gareth Jones
53367785b4 got rid of the __preLog4js stuff from the console.log replacement 2012-02-22 08:53:28 +11:00
Gareth Jones
cff20b99e3 added more gelf tests 2012-02-13 08:54:35 +11:00
Gareth Jones
0a422e5749 fixed up gelf tests 2012-02-10 18:14:50 +11:00
Shripad K
0c04c6807c More fixes + Test for "cwd" option 2012-02-08 10:25:14 +05:30
Shripad K
b4ca201a91 feature: allow passing cwd as an option 2012-02-07 12:41:10 +05:30
Gareth Jones
2ab6f5fa24 Merge pull request #56 from arifamirani/master
Fixed tests for gelf appender
2012-01-15 14:36:55 -08:00
Arif Amirani
9bad070b8a Changed tests to not use live udp server as it fails on CI 2012-01-13 13:00:53 +05:30
Gareth Jones
5aaa9fcd50 Merge pull request #54 from arifamirani/master
Add support for GELF logging using UDP
2012-01-12 15:00:11 -08:00
Arif Amirani
5bdeaf68d7 Adding gelf as an appender 2012-01-11 16:12:24 +05:30
Vincent Côté-Roy
a5b09b3ead fix restoreConsole by making console appender not depend on _preLog4js_log 2012-01-05 08:47:15 -05:00
Daniel Bell
05c4c59c20 Refactored streams to make it easier to write other rolling based file appenders. 2011-12-22 14:36:30 +11:00
Gareth Jones
b4a5227fc0 Merge pull request #49 from Pita/patch-1
Fixed a BUG that prevents connectlogger from working if loglevel is WARN
2011-12-19 15:10:29 -08:00
Gareth Jones
a999d8fc00 Fixed the file appender tests 2011-12-20 08:49:21 +11:00
Gareth Jones
78de73a274 Working version of fully-async log rolling file appender - tests need fixing though 2011-12-19 16:58:21 +11:00
Peter 'Pita' Martischka
4cf1d1cfa4 Fixed a BUG that prevents connectlogger from working if loglevel is WARN 2011-12-07 15:28:35 +01:00
Gareth Jones
f10a6e164e windows throws an EEXIST error when renaming, need to handle it 2011-11-24 08:37:05 +11:00
Gareth Jones
cea3dc97d1 Changes to handle drain events not fired on write in linux & windows - should fix issue #44 2011-11-24 08:20:33 +11:00
Gareth Jones
7d50c45801 Rewrote file appender, fixing issue #16 and issue #31 2011-11-21 15:03:51 +11:00
Gareth Jones
40c5f5ee70 added methods and config to turn off console.log replacement (issue #34) 2011-11-18 08:44:04 +11:00
Gareth Jones
050fae5230 replaced 'sys' with 'util' (issue #42) 2011-11-16 08:10:20 +11:00
Gareth Jones
342286e062 Merge pull request #40 from druciak/smtp
SMTP appender
2011-11-10 14:06:27 -08:00
druciak
537f1058b9 Add SMTP appender 2011-11-08 08:56:21 +01:00
Gareth Jones
283a403a11 Merge pull request #37 from dbrain/master
Multiprocess (tcp) appender
2011-11-02 16:03:53 -07:00
Danny Brain
a95117c0d3 Add tests for multiprocess file appender 2011-11-03 09:10:02 +11:00
Danny Brain
097390bc89 Add multiprocess appender, pending tests 2011-11-02 15:49:46 +11:00
Gareth Jones
0a0119300b Merge pull request #32 from dbrain/master
hook.io appender should accept all configuration
2011-10-30 14:47:29 -07:00
Gareth Jones
fde66f92f5 Merge branch 'master' of https://github.com/csausdev/log4js-node 2011-10-31 08:42:58 +11:00
muddydixon
5aabebbdb7 change check target from req.url to req.originalUrl 2011-10-29 11:55:46 +09:00
Danny Brain
8b376eb46e Buffer the logging until the hook is ready, will prevent lost logs 2011-10-28 10:50:28 +11:00
Danny Brain
ced570413c Pass in all appender parameters to the Hook constructor so a port can be specified 2011-10-28 10:07:48 +11:00
Danny Brain
89f3659825 Fix the logLevelFilter with lazy loading 2011-10-27 16:37:11 +11:00
Danny Brain
23a2758a6d Lazy load any new style appenders 2011-10-27 16:25:38 +11:00
Danny Brain
3b77a42706 Added a hookio appender, this allows you to run a 'master' log4js instance and 'worker' so only one process writes to file 2011-10-27 12:38:13 +11:00
muddydixon
b5bc9c8322 mod if nolog 2011-10-25 14:28:46 +09:00
muddydixon
c7d3ac4fe1 add nolog operation 2011-10-25 14:09:41 +09:00
Daniel Bell
0aca64623e Merged changes from danbell/master. 2011-10-05 15:03:08 +11:00
Daniel Bell
ff68e46858 Merged changes 2011-10-05 12:27:33 +11:00
Daniel Bell
f9768eb56e Issue #21: fixed reloading of config when config has not changed. 2011-10-05 12:22:31 +11:00
Gareth Jones
9a34d9edfd fixed missing space between log data elements 2011-09-15 08:18:24 +10:00
Gareth Jones
12e71bda4e fixed to work with node 0.5.x 2011-09-15 08:13:04 +10:00
Gareth Jones
53a481d4da Added filtering to appender loader - was choking on .svn files 2011-08-11 16:27:37 +10:00
Gareth Jones
d13b2fb3b4 turned off config file reloading by default 2011-07-27 21:21:43 +10:00
Gareth Jones
163db0e5fd fixed the behaviour of maxlogsize + 0 backups 2011-07-26 18:40:41 +10:00
Daniel Bell
623bc1859f Merged Gareth's latest changes in 2011-07-26 11:11:27 +10:00
Gareth Jones
ef9fe3a4b1 All tests pass, moved appenders into separate files, so that extra ones can be added easily 2011-07-26 08:52:40 +10:00
Gareth Jones
545681287f working fileappender, with tests, broken everything else 2011-07-24 21:58:02 +10:00
Gareth Jones
80474c6881 got log rolling working, need to fix all the tests 2011-07-22 18:25:55 +10:00
Gareth Jones
7aa076c278 removed the annoying extra new line 2011-07-22 18:25:26 +10:00
Daniel Bell
69e64932b1 Added functionality to reload configuration file periodically. 2011-07-22 14:43:33 +10:00
Gareth Jones
4b32456db7 fixed a bug where if the first log arg was not a string it wouldn't get logged 2011-07-22 12:28:02 +10:00
Gareth Jones
a9a698cf09 fixed log rolling problem 2011-07-21 20:42:14 +10:00
Gareth Jones
925c280c68 check for existence of destroySoon (does not exist in node v0.2.x) 2011-07-21 19:09:22 +10:00
Gareth Jones
d0b4563ba0 fixed small bug checking for stack on undefined object 2011-07-20 19:39:54 +10:00
Gareth Jones
0968c6709f fixed connect-logger 2011-07-19 09:08:15 +10:00
Gareth Jones
71fe001278 fixed tests to cover writestream 2011-07-17 20:49:39 +10:00
Gareth Jones
3d27140a9d changed fileappender to use writeStream instead of fs.write, tests don't work 2011-07-17 12:28:26 +10:00
Gareth Jones
d64d4ca0ca updated to remove TODO and credit danbell 2011-07-15 09:13:09 +10:00
Gareth Jones
b338b34fd6 added tests for pattern layout 2011-07-15 08:22:44 +10:00
Gareth Jones
3691648cd0 fixed patternlayout, needs tests though 2011-07-13 18:42:56 +10:00
Gareth Jones
d7ffa59434 moved level colours into layouts where they belong, updated README 2011-07-13 18:29:53 +10:00
Gareth Jones
5868856a7d all tests pass, now with proper console.log formatting 2011-07-13 18:12:29 +10:00
Gareth Jones
f89d54b66e removed main function, now using felixge's sandboxed-module, split code into multiple files 2011-07-12 13:03:17 +10:00
Gareth Jones
e121ca345a removed main function, now using felixge's sandboxed-module, split code into multiple files 2011-07-12 13:02:48 +10:00
Gareth Jones
8767cda15f removed the extensions to Date, put them in their own library 2011-07-08 08:15:13 +10:00
Alexander Sulfrian
d7a97366cb global log level is now set via the log4js object 2011-05-30 13:26:30 +02:00
Alexander Sulfrian
1fa9d029a2 added possibility to define global and local log levels 2011-05-19 15:25:13 +02:00
csausdev
9f4878d82c Disabling the console.log replacement 2011-04-17 17:46:13 +10:00
csausdev
a50c02a3e5 Added coloured layout to configuration (thanks @melin) 2011-04-17 17:20:49 +10:00
Daniel Bell
59f7e0af3c Added connect/express logger. 2011-04-07 10:19:18 +10:00
csausdev
71459ab6d3 changed array detection (thanks fkei) 2011-03-04 19:49:43 +11:00
csausdev
a876dfbe9c configure now takes a filename or object 2011-01-16 13:21:37 +11:00
csausdev
c6dd2398ab Persist logging config across invocations 2011-01-16 13:05:13 +11:00
csausdev
612d9eeb23 small tweak to exception handling 2010-12-11 21:59:50 +11:00
csausdev
c870289928 now handles exceptions that aren't Errors 2010-12-11 21:55:21 +11:00
csausdev
c2f9ccce73 enhanced console.log 2010-12-08 08:53:59 +11:00
csausdev
2b7be410ea added messagePassThroughLayout to vows tests 2010-12-06 18:31:08 +11:00
csausdev
966b8ced4f Added log rolling to config files 2010-12-06 18:23:43 +11:00
csausdev
75b9e82cac added a log rolling function to file appender 2010-12-06 09:14:20 +11:00
csausdev
4406f211c4 added test for log roller, not written yet 2010-12-05 17:17:37 +11:00
csausdev
8145e3b08f added masylum's coloured layout function 2010-12-05 14:36:35 +11:00
csausdev
6032c073b3 Added loading of config from require paths, and now defaults to console appender with basic layout 2010-12-05 11:04:28 +11:00
csausdev
c52af1b997 refactoring to allow dependency injection 2010-12-04 20:49:39 +11:00
Gareth Jones
5ffc00c9de appenders can be added to multiple categories at the same time 2010-10-07 15:15:23 +11:00
csausdev
6c8ce6614d renamed log4js-node.js to log4js.js 2010-08-10 21:56:54 +10:00
csausdev
8951600acd updated to work with npm 2010-08-10 21:56:10 +10:00