Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
maven
0002-Invoke-logback-via-reflection.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Invoke-logback-via-reflection.patch of Package maven
From d1e6e9bcce8553e85957987d05d28583fcb55fdf Mon Sep 17 00:00:00 2001 From: Michael Simacek <msimacek@redhat.com> Date: Tue, 6 Jun 2017 13:47:43 +0200 Subject: [PATCH 2/4] Invoke logback via reflection --- .../cli/logging/impl/LogbackConfiguration.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java index 4dc5a37b8..a977ba085 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java @@ -31,21 +31,29 @@ public class LogbackConfiguration extends BaseSlf4jConfiguration { @Override public void setRootLoggerLevel(Level level) { - ch.qos.logback.classic.Level value; + String value; switch (level) { case DEBUG: - value = ch.qos.logback.classic.Level.DEBUG; + value = "DEBUG"; break; case INFO: - value = ch.qos.logback.classic.Level.INFO; + value = "INFO"; break; default: - value = ch.qos.logback.classic.Level.ERROR; + value = "ERROR"; break; } - ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(value); + Logger logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + try { + Class<?> levelClass = Class.forName("ch.qos.logback.classic.Level"); + Object logbackLevel = levelClass.getField(value).get(null); + Class<?> loggerClass = Class.forName("ch.qos.logback.classic.Logger"); + loggerClass.getMethod("setLevel", new Class<?>[] {levelClass}).invoke(logger, new Object[] {logbackLevel}); + } catch (Exception e) { + throw new RuntimeException("Failed to initialize logback configuration", e); + } } @Override -- 2.40.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor