maven/0001-Force-SLF4J-SimpleLogger-re-initialization.patch

45 lines
1.6 KiB
Diff
Raw Normal View History

2017-02-01 14:08:45 +00:00
From 0ace877175e4fa35f1de3bf37edc1a05b6927d47 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
2017-02-01 14:08:45 +00:00
@@ -30,6 +32,19 @@ public class MavenSlf4jSimpleFriend
{
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 )
--
2017-02-01 14:08:45 +00:00
2.9.3