Commit Graph

530 Commits

Author SHA1 Message Date
Gareth Jones
4a217afc37 Merge pull request #278 from cfogelberg/custom-connect-tokens
Custom connect tokens
2015-03-12 10:02:24 +11:00
Christo Fogelberg
41504a755d test/connect-logger-test.js - tests for custom tokens 2015-03-10 06:37:53 +00:00
Christo Fogelberg
f22621199f test/connect-logger-test.js - trailing whitespace Sublime removed 2015-03-10 06:24:57 +00:00
Christo Fogelberg
25c543f8ae lib/connect-logger.js - allow options.tokens 2015-03-10 06:18:02 +00:00
Christo Fogelberg
24268422cf lib/connect-logger.js - format takes tokens array instead of req, res 2015-03-10 06:13:49 +00:00
Christo Fogelberg
ba80dc1588 Trailing whitespace Sublime removed 2015-03-08 19:36:17 +00:00
Gareth Jones
35067af550 0.6.22 2015-01-10 15:40:03 +11:00
Gareth Jones
d31521bac0 Merge pull request #240 from vivocha/vivocha-0.6.20
Vivocha 0.6.20
2015-01-10 15:34:31 +11:00
Gareth Jones
6d7cab343d Merge pull request #260 from DerKnerd/patch-1
Update README.md
2015-01-10 15:29:53 +11:00
Gareth Jones
c624aef282 Merge pull request #261 from boljen/clusterpid
added cluster identifier support
2015-01-10 15:29:01 +11:00
Gareth Jones
0ae72ee424 Merge pull request #264 from FleetingClouds/master
Force bundling of appenders/console
2015-01-10 15:26:39 +11:00
Gareth Jones
a4be20f8e1 Merge pull request #266 from sc2bigjoe/patch-1
Update smtp.js
2015-01-10 15:23:28 +11:00
Gareth Jones
d10d40b572 Merge pull request #268 from askhogan/master
Allow for blank tokens due to dynamic data
2015-01-10 15:22:24 +11:00
Gareth Jones
51ab2963d0 Merge pull request #269 from Nekle/master
add options to reload function
2015-01-10 15:21:46 +11:00
Fuxian Ding
1f1442cb7c add options to reload function
if `cwd` is included in option, reload will not work
2014-12-27 12:48:24 +08:00
Patrick Hogan
f987990339 added null tests 2014-12-23 19:42:32 -08:00
Patrick Hogan
6b029e98fc Allow for blank tokens due to dynamic data
Metadata for users such as name, email, etc are not always present for users.  For example, I am running express and I want to log the %x{company}%x{username} so that when I look at my logs I can immediately understand which user this affects.  Or for example, I could log %x{payingOrTial} the type of user.  

This works well when the user is logged in.  However, my logger encompasses everything.  I log when the server boots up.  I log during the login screen where a user is not yet logged in.  In these circumstances there is no way to retrieve this metadata.

So for example

```
"username": function () {
            var session = require('continuation-local-storage').getNamespace('api.callinize');
            if(!session) session = require('continuation-local-storage').getNamespace('dashboard.callinize');
            var username = session && session.get('user') && session.get('user').username;
            if(!username) return "";
            return " " + username + " ";
        }
```

I try to get the metadata.  If I get no metdata I return a blank string.  Unfortunately, in the current implementation, due to the OR operator, even if I have a replacement of "" || matchedString, 

```
  replaceToken(conversionCharacter, loggingEvent, specifier) || 
          matchedString;
```

the blank string equals false and puts the token in the log instead of the blank string.  This makes the log lines get long with information that is not relevant.  The better thing to do is simply allow for blank strings.  This lets the user have control over their logs and also allows for more metadata to go in the logs, without having to pick only metadata that is always present.
2014-12-21 14:49:25 -08:00
sc2bigjoe
1629e01df9 Update smtp.js
added the ability for smtp appender to send message as html instead of plaintext. in your log4js.config file simply include "html": "true", to write out as html, otherwise it will send plaintext
2014-12-17 11:28:50 -05:00
Martin Bramwell
ec72c03f81 Force bundling of appenders/console
Changes to be committed:
	modified:   lib/log4js.js
2014-12-09 02:59:58 -05:00
Christophe Bol
3300dfae60 fixed error when logging from the clustered master 2014-12-01 15:34:09 +01:00
Christophe Bol
b694fd1d8d added cluster identifier support 2014-12-01 12:29:45 +01:00
Imanuel Ulbricht
e07adf2ca4 Update README.md 2014-11-28 17:49:46 +01:00
Gareth Jones
ec5f4485f8 Merge pull request #258 from osher/patch-4
fix bug: headers are changed after log entry emits
2014-11-16 09:19:47 +11:00
osher
2f44dbf53e 0.8 compatibility 2014-11-05 11:58:09 +02:00
osher
9da158f945 fix tests - they have to be async! 2014-11-05 11:49:21 +02:00
osher
cd3971cc03 fix bug: headers are changed after log entry emits
In the original version, the following operation looks synchronic, however it is not:

```
res.end = end;
res.end(data,enc);

//emit the log entry 
```

In fact, it starts a series of async operations, in which the request may yet be changed after the request log has already been emitted
(in our case - a change on request headers was observed, probably by some low level hook or hacky wrap of some http.ServerResponse method that's involved on the process - but called asynchronously)
what leads to situation that the request log does not capture valid data.
(observed by us:
 - request headers
 - calculated end time, when concerning big content
)

The fix just used `setTimeout(function() { /*emit the log entry*/ }, 1)`, but I'm afraid it may not hold true for big contents.
Well. maybe the headers part will, but the response time calculation will lie.

The fix relays on: http://nodejs.org/api/http.html#http_event_finish
2014-11-04 17:28:52 +02:00
Gareth Jones
176d44833e 0.6.21 2014-09-11 09:26:02 +10:00
Gareth Jones
988e9a41f6 added license info 2014-09-11 09:23:55 +10:00
Gareth Jones
39ce97d140 Merge pull request #242 from marcelog/marcelog_logstash_udp_appender
adding logstash UDP appender
2014-09-11 09:20:42 +10:00
Gareth Jones
c753fe37bb Merge pull request #243 from laenger/master
pass options to wrapped appender in logLevelFilter
2014-09-11 09:16:46 +10:00
Marcelo Gornstein
a7a0964803 adding logstash UDP appender 2014-09-10 13:03:21 -03:00
Christian Langer
82950eb965 pass options to wrapped appender in logLevelFilter 2014-09-09 03:28:02 +02:00
Luis Malheiro
1e999f36d7 Fix and test for MARK level. 2014-09-08 12:17:50 +02:00
Luis Malheiro
17c9b29ca5 Removed property 'level' from the file appender, because that functionality is provided by appender logLevelFilter. 2014-09-08 11:33:22 +02:00
Luis Malheiro
492c45d055 Test for appender using subcategories. 2014-09-08 11:14:00 +02:00
Luis Malheiro
ebbbea198d Added test to check loggers using sub-categories. 2014-09-02 14:33:51 +02:00
Gareth Jones
cacade0a37 Merge pull request #239 from lazutkin/gh-238
Closes #238 Updated async library
2014-09-02 19:33:58 +10:00
Luis Malheiro
02ea4831ea Test for the 'compress' option at the file appender. 2014-09-01 18:05:36 +02:00
Luis Malheiro
39a73586ed Fixed bug that failed test 'set level on all categories' 2014-09-01 14:37:25 +02:00
Luis Malheiro
036293db41 Log compression. 2014-08-29 16:33:41 +02:00
Luis Malheiro
6fa998408a Adds subcategories to the appenders and loggers. Adds property "level" at the file appender to limit the levels that a file appender accepts.
Creates a MARK category that always write to the log. That's useful to write things like '---- STARTED ----'.
2014-08-29 16:33:32 +02:00
Dmitry M. Lazutkin
7558a3c367 Closes #238 Updated async library in order to use lib in —use-strict mode 2014-08-28 12:04:02 +04:00
Gareth Jones
fb072dd70d 0.6.20 2014-08-26 09:59:10 +10:00
Gareth Jones
af1ce2933b Merge pull request #236 from jchmura/filter-max-level
Added option for maximum level in logLevelFilter
2014-08-26 09:55:13 +10:00
Jakub Chmura
ade6dd8ea0 Adjusting and adding new tests for logLevelFilter to handle the maxLevel option. 2014-08-25 20:56:37 +02:00
Jakub Chmura
00c62c7fa6 Adding maxLevel to levelFilter.
This optional parameter specifies what maximum level of event is accepted by the filter.
2014-08-25 19:48:15 +02:00
Gareth Jones
ae04cc9a4a 0.6.19 2014-08-21 21:21:16 +10:00
Gareth Jones
70a9444f4d Merge pull request #235 from j2ro/master
Pull request for #233
2014-08-21 21:20:27 +10:00
j2ro
3e78fcb630 #233: Adding ability to put pid in log layout pattern 2014-08-20 10:43:48 +01:00
j2ro
44687e1bd1 #233: Adding ability to put pid in log layout pattern 2014-08-20 10:23:31 +01:00