Commit Graph

552 Commits

Author SHA1 Message Date
Francisco Dans
145d5f91e3 Merge pull request #1 from CartoDB/master
Upstream update, adds x-forwarde-for by default
2015-06-01 16:02:53 +02:00
Francisco Dans
3bf2bade32 x-forwarded-for 2015-06-01 15:30:46 +02:00
Gareth Jones
0c74fbbf7d added node 0.12 to travis config 2015-05-13 08:06:16 +10:00
Gareth Jones
8dff114b49 0.6.25 2015-05-13 08:03:35 +10:00
Gareth Jones
c76fe098ae Merge pull request #294 from Skiggz/gelf-fix
Remove GELF flag when capturing custom fields
2015-05-13 07:54:33 +10:00
Skylar Lowery
1454ae5350 Use isUndefined test method vs equals undefined
*doh
2015-04-27 11:01:20 -06:00
Skylar Lowery
3cf1d697e8 Remove GELF flag when capturing custom fields
* Logstash (which supports GELF) drops messages with this key
* There's no particular need to keep this key
2015-04-24 11:14:17 -06:00
Gareth Jones
9fe32d06e3 0.6.24 2015-04-17 11:36:22 +10:00
Gareth Jones
b8e1d03928 Merge pull request #292 from hasegawa-jun/fix-reference-error
make sure to call require()
2015-04-17 11:35:28 +10:00
hasegawa-jun
ebfcf94db3 make sure to call require() 2015-04-17 10:08:00 +09:00
Gareth Jones
adeb714243 made calling logger.log safe if level is not provided as first argument (github issue #279) 2015-04-17 08:31:12 +10:00
Gareth Jones
1cdd37c488 0.6.23 2015-04-17 08:21:00 +10:00
Gareth Jones
eb87ccb78d Merge pull request #277 from hasegawa-jun/shutdown-smtp-appender
Implemented shutdown function for SMTP appender
2015-04-17 08:12:17 +10:00
Gareth Jones
8360bb732c Merge pull request #282 from qbrandon/master
Add appender-level timezone offset config
2015-04-17 08:10:15 +10:00
Gareth Jones
085a88d6fc upgraded semver package version (github issue #291) 2015-04-17 08:05:47 +10:00
Gareth Jones
957d5d369d Merge pull request #288 from alawatthe/nodemailermigration
The smtp appender now works with the current version of nodemailer - fixes #287
2015-04-17 07:54:57 +10:00
alawatthe
57fc9e7aa0 The smtp appender now works with the current version of nodemailer 2015-04-11 12:03:14 +02:00
Quentin Brandon
435f4f320f Bugfixes: get the unit tests passing again 2015-03-20 18:35:53 +09:00
Quentin Brandon
af69eddd1c Add optional timezoneOffset config for appenders
Example:
    log4js.configure({
        appenders: [{type: 'console', timezoneOffset: -540}],
        replaceConsole: true
    });

The expected value is the equivalent of (new Date).getTimezoneOffset()
In this example, -540 is the value for JST.
This allows machines members of world-wide-spread cluster to all report
log time-stamps using the same timezone (or adapt the timezone to a
local different from the system)
2015-03-20 11:51:23 +09:00
hasegawa-jun
4dfe14a0c2 added shutdownTimeout option 2015-03-17 09:25:22 +09:00
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
hasegawa-jun
adfad9ad20 Implemented shutdown function for SMTP appender 2015-03-04 09:13:30 +09: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
Raul Ochoa
a669f7c2f4 Allow shutting down of appenders without disabling future log writes 2014-12-02 12:16:15 +01: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