563 Commits

Author SHA1 Message Date
Gareth Jones
b37c171e5c Merge pull request #305 from pmalouin/patch-1
clustered appender - Unwrap the serialized errors
2015-09-22 08:28:16 +10:00
Gareth Jones
1ea98b3836 Merge pull request #312 from ezbin/feature-smtp-transport-plugins
Feature - Add support for nodemailer transport plugins
2015-09-22 08:26:08 +10:00
Gareth Jones
ba3c9c398e updated travis config to use new containers 2015-09-22 08:13:39 +10:00
Edward Zborowski
2642c89070 Added a extra sandbox requires to get tests passing 2015-07-08 22:43:51 -04:00
Edward Zborowski
5f3a0f293a Use a nodemailer transport plugin if transport option is provided 2015-07-08 21:41:08 -04:00
Edward Zborowski
3b6c631b83 Created tests for new smtp transport option 2015-07-08 21:20:29 -04:00
Patrick Malouin
2cdbd60c7e Add test for the logging event deserialization 2015-06-11 16:20:54 -04:00
Gareth Jones
fc4cdea50d 0.6.26 v0.6.26 2015-06-11 07:13:56 +10:00
Gareth Jones
25cf884f97 Merge branch 'MaxXx1313-master' 2015-06-11 07:11:30 +10:00
Gareth Jones
fe7a863bde Merge branch 'master' of https://github.com/MaxXx1313/log4js-node into MaxXx1313-master 2015-06-11 07:10:08 +10:00
Gareth Jones
35ad3b696a Merge pull request #301 from CartoDB/master
Use x-forwarded-for if available for :remote-addr
2015-06-11 07:03:23 +10:00
Patrick Malouin
7c22fb5752 clustered appender - Unwrap the serialized errors
When logging an `Error` object using the clustered appender, the logged event is a JSON representation of the error, ex:
[2015-06-09 11:13:48.257] [ERROR] middleware.Security - { stack: 'Error: User is not authorized\n at Object.exec (D:\\Borealis\\demoux\\IMS\\server\\IMS\\middleware\\SecurityCheck\\Instance.js:41:14)\n [...] at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at Function.flowState (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:39:6)\n at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at Function.thisFlow.exec (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:94:4)\n at applyArgs (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:9:15)\n at thisFlow (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:15:4)\n at Object.exec (D:\\Borealis\\demoux\\IMS\\server\\node_modules\\flow\\flow.js:103:42)' } 

The error should be formatted identically as with other appenders (e.g. only printing the stack).

This changes adds a check for a `stack` attribute on the serialized loggingEvent and unwraps the errors while deserializing it. Result is:
[2015-06-09 11:13:48.257] [ERROR] middleware.Security - Error: User is not authorized
 at Object.exec (D:\Borealis\demoux\IMS\server\IMS\middleware\SecurityCheck\Instance.js:41:14)
 at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
 at Function.flowState (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:39:6)
 at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
 at Function.thisFlow.exec (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:94:4)
 at applyArgs (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:9:15)
 at thisFlow (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:15:4)
 at Object.exec (D:\Borealis\demoux\IMS\server\node_modules\flow\flow.js:103:42)
2015-06-10 10:32:36 -04: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 v0.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
MaxXx1313
799af3be5d add protocol and hostname to output format for express 2015-04-29 17:10:05 +03: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 v0.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 v0.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 v0.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