10000 Merge pull request #329 from mercury2269/patch-1 · chewax/log4js-node@aeb03af · GitHub
[go: up one dir, main page]

Skip to content

Commit aeb03af

Browse files
committed
Merge pull request log4js-node#329 from mercury2269/patch-1
Add missing category field
2 parents 515291b + 84611d9 commit aeb03af

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/appenders/logstashUDP.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function logstashUDP (config, layout) {
2121
'@timestamp': (new Date(loggingEvent.startTime)).toISOString(),
2222
type: type,
2323
message: logMessage,
24-
fields: fields
24+
fields: fields,
25+
category: loggingEvent.logger.category
2526
};
2627
sendLog(udp, config.host, config.port, logObject);
2728
};

test/logstashUDP-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function setupLogging(category, options) {
4242
vows.describe('logstashUDP appender').addBatch({
4343
'when logging with logstash via UDP': {
4444
topic: function() {
45-
var setup = setupLogging('logstashUDP', {
45+
var setup = setupLogging('myCategory', {
4646
"host": "127.0.0.1",
4747
"port": 10001,
4848
"type": "logstashUDP",
@@ -73,6 +73,7 @@ vows.describe('logstashUDP appender').addBatch({
7373
};
7474
assert.equal(JSON.stringify(json.fields), JSON.stringify(fields));
7575
assert.equal(json.message, 'Log event #1');
76+
assert.equal(json.category, 'myCategory');
7677
// Assert timestamp, up to hours resolution.
7778
var date = new Date(json['@timestamp']);
7879
assert.equal(

0 commit comments

Comments
 (0)
0