Skip to content

Commit

Permalink
Adding testcase for dynamicMdcFieldTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Konrad committed Jan 12, 2024
1 parent b79b1ea commit c266216
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import jakarta.ws.rs.Path;

import org.jboss.logging.Logger;
import org.jboss.logging.MDC;

/**
* This endpoint allow to test central logging solution by generating a log event when
Expand All @@ -33,6 +34,8 @@ public class GelfLogHandlerResource {

@GET
public void log() {
MDC.put("field3", 99);
MDC.put("field4", 98);
LOG.info("Some useful log message");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ quarkus.log.handler.gelf.facility=custom
quarkus.log.handler.gelf.additional-field.field1.value=value
quarkus.log.handler.gelf.additional-field.field1.type=String
quarkus.log.handler.gelf.additional-field.field2.value=666
quarkus.log.handler.gelf.additional-field.field2.type=long
quarkus.log.handler.gelf.additional-field.field2.type=long
quarkus.log.handler.gelf.include-full-mdc=true
quarkus.log.handler.gelf.dynamic-mdc-field-types=field3=String
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void test() {
assertEquals(200, response.statusCode());
assertNotNull(response.body().path("hits.hits[0]._source"));
assertEquals("Some useful log message", response.body().path("hits.hits[0]._source.message"));
assertEquals(Integer.valueOf(98), response.body().path("hits.hits[0]._source.field4"));
assertEquals("99", response.body().path("hits.hits[0]._source.field3"));
});
}
}

0 comments on commit c266216

Please sign in to comment.