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)
This commit is contained in:
Quentin Brandon
2015-03-20 11:51:23 +09:00
parent 4a217afc37
commit af69eddd1c
7 changed files with 44 additions and 33 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ function smtpAppender(config, layout) {
var firstEvent = logEventBuffer[0];
var body = "";
while (logEventBuffer.length > 0) {
body += layout(logEventBuffer.shift()) + "\n";
body += layout(logEventBuffer.shift(), config.timezoneOffset) + "\n";
}
var msg = {