maven/0001-Force-SLF4J-SimpleLogger-re-initialization.patch
Mikolaj Izdebski d0a8fbfe89 Force SLF4J SimpleLogger re-initialization
- Resolves: rhbz#1324832
2016-04-08 01:07:55 +02:00

45 lines
1.6 KiB
Diff

From 623fb2bd14731aac8fdc29e3544d765e953707fc Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 8 Apr 2016 01:05:29 +0200
Subject: [PATCH] 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.5.0