maven/0001-Force-SLF4J-SimpleLogger-re-initialization.patch
2016-08-15 11:30:22 +02:00

45 lines
1.6 KiB
Diff

From d525c9b0b5d1bc61cff6c32164af71a449a074a9 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 8 Apr 2016 01:05:29 +0200
Subject: [PATCH 1/2] Force SLF4J SimpleLogger re-initialization
---
.../main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
index bffd18c..5af6a68 100644
--- a/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
+++ b/maven-embedder/src/main/java/org/slf4j/impl/MavenSlf4jSimpleFriend.java
@@ -1,5 +1,7 @@
package org.slf4j.impl;
+import java.lang.reflect.Field;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -30,6 +32,19 @@
{
public static void init()
{
+ // Force SimpleLogger re-initialization
+ // See https://bugzilla.redhat.com/show_bug.cgi?id=1324832
+ try
+ {
+ Field initializedField = SimpleLogger.class.getDeclaredField( "INITIALIZED" );
+ initializedField.setAccessible( true );
+ initializedField.set( null, false );
+ }
+ catch ( ReflectiveOperationException e )
+ {
+ throw new RuntimeException( e );
+ }
+
SimpleLogger.init();
ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
if ( loggerFactory instanceof SimpleLoggerFactory )
--
2.7.4