Skip to content

Commit 93bf8e2

Browse files
authored
Merge pull request #60 from avaje/feature/rename-stacktrace-field
Rename stacktrace field to align with logstash
2 parents b1d0c2c + 1bbee06 commit 93bf8e2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/java/io/avaje/logback/encoder/JsonEncoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class JsonEncoder extends EncoderBase<ILoggingEvent> {
3232

3333
public JsonEncoder() {
3434
this.json = JsonStream.builder().build();
35-
this.properties = json.properties("component", "env", "timestamp", "level", "logger", "message", "thread", "exception");
35+
this.properties = json.properties("component", "env", "timestamp", "level", "logger", "message", "thread", "stacktrace");
3636
}
3737

3838
@Override

src/main/java/io/avaje/logback/encoder/ShortenedThrowableConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class ShortenedThrowableConverter extends ThrowableHandlingConverte
7373

7474
public static final int FULL_MAX_DEPTH_PER_THROWABLE = Integer.MAX_VALUE;
7575
public static final int SHORT_MAX_DEPTH_PER_THROWABLE = 3;
76-
public static final int DEFAULT_MAX_DEPTH_PER_THROWABLE = FULL_MAX_DEPTH_PER_THROWABLE;
76+
public static final int DEFAULT_MAX_DEPTH_PER_THROWABLE = Integer.getInteger("avaje.logback.maxDepthPerThrowable", FULL_MAX_DEPTH_PER_THROWABLE);
7777

7878
public static final int FULL_MAX_LENGTH = Integer.MAX_VALUE;
7979
public static final int SHORT_MAX_LENGTH = 1024;

src/test/java/io/avaje/logback/encoder/JsonEncoderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void throwable_usingDefault() {
7676
SimpleMapper simpleMapper = SimpleMapper.builder().build();
7777
Map<String, Object> asMap = simpleMapper.map().fromJson(bytes);
7878

79-
assertThat((String)asMap.get("exception")).startsWith("java.lang.NullPointerException: ");
79+
assertThat((String)asMap.get("stacktrace")).startsWith("java.lang.NullPointerException: ");
8080
}
8181

8282
@Test
@@ -96,7 +96,7 @@ void throwable_usingConverter() {
9696
SimpleMapper simpleMapper = SimpleMapper.builder().build();
9797
Map<String, Object> asMap = simpleMapper.map().fromJson(bytes);
9898

99-
assertThat((String)asMap.get("exception")).startsWith("j.l.NullPointerException: ");
99+
assertThat((String)asMap.get("stacktrace")).startsWith("j.l.NullPointerException: ");
100100
}
101101

102102
Throwable createThrowable() {

0 commit comments

Comments
 (0)