Skip to content

Commit

Permalink
small test cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Ivarsson <[email protected]>
  • Loading branch information
pativa committed Jan 17, 2025
1 parent ec8bd27 commit f2005b6
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ void asyncLogShouldNotBeDuplicated() throws IOException {
@Issue("#5756")
@Test
void rebindsMetricsWhenConfigurationIsReloaded() {
MeterRegistry registry = new SimpleMeterRegistry();
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Logger logger = context.getLogger(getClass());
LoggerContext context = new LoggerContext("test");
Logger logger = context.getLogger("com.test");

try (Log4j2Metrics metrics = new Log4j2Metrics(emptyList(), context)) {
metrics.bindTo(registry);
Expand All @@ -208,9 +207,8 @@ void rebindsMetricsWhenConfigurationIsReloaded() {

@Test
void shouldNotRebindMetricsIfBinderIsClosed() {
MeterRegistry registry = new SimpleMeterRegistry();
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Logger logger = context.getLogger(getClass());
LoggerContext context = new LoggerContext("test");
Logger logger = context.getLogger("com.test");

try (Log4j2Metrics metrics = new Log4j2Metrics(emptyList(), context)) {
metrics.bindTo(registry);
Expand Down

0 comments on commit f2005b6

Please sign in to comment.