Skip to content

Commit 7177746

Browse files
authored
Merge pull request #13 from newrelic/v1.1.3
feat: Added severity, logger dedicated logging attributes
2 parents 5dc7d9f + 120d15f commit 7177746

File tree

10 files changed

+959
-660
lines changed

10 files changed

+959
-660
lines changed

custom-log4j2-appender/build-jar.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jar {
2020
'Implementation-Title': 'Custom Log4j2 Appender',
2121
'Implementation-Vendor': 'New Relic Labs',
2222
'Implementation-Vendor-Id': 'com.newrelic.labs',
23-
'Implementation-Version': '1.1.2'
23+
'Implementation-Version': '1.1.3'
2424
)
2525
}
2626
}
@@ -53,7 +53,7 @@ publishing {
5353

5454
groupId = 'com.newrelic.labs'
5555
artifactId = 'custom-log4j2-appender'
56-
version = '1.1.2'
56+
version = '1.1.3'
5757

5858
pom {
5959
name = 'Custom Log4j2 Appender'

custom-log4j2-appender/build-shadowJar.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ shadowJar {
2727
'Implementation-Title': 'Custom Log4j2 Appender',
2828
'Implementation-Vendor': 'New Relic Labs',
2929
'Implementation-Vendor-Id': 'com.newrelic.labs',
30-
'Implementation-Version': '1.1.2'
30+
'Implementation-Version': '1.1.3'
3131
)
3232
}
3333
}
@@ -55,7 +55,7 @@ publishing {
5555

5656
groupId = 'com.newrelic.labs'
5757
artifactId = 'custom-log4j2-appender'
58-
version = '1.1.2'
58+
version = '1.1.3'
5959

6060
pom {
6161
name = 'Custom Log4j2 Appender'
@@ -93,4 +93,4 @@ publishing {
9393
}
9494
}
9595
}
96-
}
96+
}

custom-log4j2-appender/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jar {
2020
'Implementation-Title': 'Custom Log4j2 Appender',
2121
'Implementation-Vendor': 'New Relic Labs',
2222
'Implementation-Vendor-Id': 'com.newrelic.labs',
23-
'Implementation-Version': '1.1.2'
23+
'Implementation-Version': '1.1.3'
2424
)
2525
}
2626
}
@@ -53,7 +53,7 @@ publishing {
5353

5454
groupId = 'com.newrelic.labs'
5555
artifactId = 'custom-log4j2-appender'
56-
version = '1.1.2'
56+
version = '1.1.3'
5757

5858
pom {
5959
name = 'Custom Log4j2 Appender'

custom-log4j2-appender/publish-jar-legacy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cp build-jar.gradle build.gradle
77
# Set variables
88
GROUP_ID="com.newrelic.labs"
99
ARTIFACT_ID="custom-log4j2-appender"
10-
VERSION="1.1.2"
10+
VERSION="1.1.3"
1111
KEY_ID="0ED9FD74E81E6D83FAE25F235640EA0B1C631C6F" # Replace with your actual key ID
1212

1313
# Get the current directory (assuming the script is run from the custom-log4j2-appender directory)

custom-log4j2-appender/publish-jar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cp build-jar.gradle build.gradle
77
# Set variables
88
GROUP_ID="io.github.newrelic-experimental"
99
ARTIFACT_ID="custom-log4j2-appender"
10-
VERSION="1.1.2"
10+
VERSION="1.1.3"
1111
KEY_ID="0ED9FD74E81E6D83FAE25F235640EA0B1C631C6F" # Replace with your actual key ID
1212

1313
# Get the current directory (assuming the script is run from the custom-log4j2-appender directory)

custom-log4j2-appender/publish-shadowJar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cp build-shadowJar.gradle build.gradle
66
# Set variables
77
GROUP_ID="io.github.newrelic-experimental"
88
ARTIFACT_ID="custom-log4j2-appender"
9-
VERSION="1.1.2"
9+
VERSION="1.1.3"
1010
KEY_ID="0ED9FD74E81E6D83FAE25F235640EA0B1C631C6F" # Replace with your actual key ID
1111

1212
# Get the current directory (assuming the script is run from the custom-log4j2-appender directory)

custom-log4j2-appender/src/main/java/com/newrelic/labs/LogEntry.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package com.newrelic.labs;
23

34
import java.util.Map;
@@ -12,15 +13,19 @@ public class LogEntry {
1213
private final String applicationName;
1314
private final String name;
1415
private final String logtype;
16+
private final String logger;
17+
private final String severity;
1518
private final long timestamp;
1619
private final Map<String, Object> properties; // Add custom fields
1720

18-
public LogEntry(String message, String applicationName, String name, String logtype, long timestamp,
19-
Map<String, Object> properties, boolean mergeCustomFields) {
21+
public LogEntry(String message, String applicationName, String name, String logtype, String loggername,
22+
String loglevel, long timestamp, Map<String, Object> properties, boolean mergeCustomFields) {
2023
this.message = message;
2124
this.applicationName = applicationName;
2225
this.name = name;
2326
this.logtype = logtype;
27+
this.logger = loggername;
28+
this.severity = loglevel;
2429
this.timestamp = timestamp;
2530
this.properties = properties; // Initialize custom fields
2631
}
@@ -31,19 +36,24 @@ public LogEntry() {
3136
this.applicationName = null;
3237
this.name = null;
3338
this.logtype = null;
39+
this.logger = null;
40+
this.severity = null;
3441
this.timestamp = 0L;
3542
this.properties = null; // Initialize custom fields
3643
}
3744

3845
@JsonCreator
3946
public LogEntry(@JsonProperty("message") String message, @JsonProperty("applicationname") String applicationName,
4047
@JsonProperty("name") String name, @JsonProperty("logtype") String logtype,
48+
@JsonProperty("logger") String logger, @JsonProperty("severity") String severity,
4149
@JsonProperty("timestamp") long timestamp, @JsonProperty("custom") Map<String, Object> properties) { // Add
4250

4351
this.message = message;
4452
this.applicationName = applicationName;
4553
this.name = name;
4654
this.logtype = logtype;
55+
this.logger = logger;
56+
this.severity = severity;
4757
this.timestamp = timestamp;
4858
this.properties = properties; // Initialize custom fields
4959
}
@@ -64,6 +74,14 @@ public String getLogType() {
6474
return logtype;
6575
}
6676

77+
public String getLogger() {
78+
return logger;
79+
}
80+
81+
public String getSeverity() {
82+
return severity;
83+
}
84+
6785
public long getTimestamp() {
6886
return timestamp;
6987
}

0 commit comments

Comments
 (0)