Repository: quarkusio/quarkus
Issue: UnsupportedOperationException thrown at startup for  vertx-quickstart project with Java 11

**Describe the bug**
When starting vertx-quickstart project (from quarkus quickstart examples) via ```mvn compile quarkus:dev -Dquarkus.log.level=DEBUG``` the following stack trace is shown in the logs: 
```
2019-11-05 13:00:34,557 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) direct buffer constructor: unavailable: java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
	at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
	at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:224)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:218)
	at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:272)
	at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
	at io.netty.buffer.UnpooledByteBufAllocator.<clinit>(UnpooledByteBufAllocator.java:37)
	at io.netty.buffer.Unpooled.<clinit>(Unpooled.java:73)
	at io.netty.handler.codec.http.HttpObjectEncoder.<clinit>(HttpObjectEncoder.java:53)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at io.quarkus.netty.deployment.NettyProcessor.build(NettyProcessor.java:81)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

2019-11-05 13:00:34,558 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) java.nio.Bits.unaligned: available, {}
2019-11-05 13:00:34,559 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @75b061d
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
	at java.base/java.lang.reflect.Method.invoke(Method.java:558)
	at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:334)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:325)
	at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:272)
	at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
	at io.netty.buffer.UnpooledByteBufAllocator.<clinit>(UnpooledByteBufAllocator.java:37)
	at io.netty.buffer.Unpooled.<clinit>(Unpooled.java:73)
	at io.netty.handler.codec.http.HttpObjectEncoder.<clinit>(HttpObjectEncoder.java:53)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at io.quarkus.netty.deployment.NettyProcessor.build(NettyProcessor.java:81)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)

```

**Expected behavior**
No stack trace (or fail to start application)

**Actual behavior**
Application is started with possible errors.

**To Reproduce**
Steps to reproduce the behavior:
1. git clone https://github.com/quarkusio/quarkus-quickstarts.git
2. cd quarkus-quickstarts/vertx-quickstart
3. mvn compile quarkus:dev -Dquarkus.log.level=DEBUG

Just after the application is about to start, this exception occurs and the stack trace is logged. This is probably related to Java modules (which was introduces in Java 9).

**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: 
Darwin MacBook-Pro.local 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
 - Output of `java -version`: 
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
 - GraalVM version (if different from Java): N/A 
 - Quarkus version or git rev: 0.28.1


Changed files:
core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
index ac6f9b42923..e856ae2b974 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
@@ -1,6 +1,7 @@
 package io.quarkus.deployment.logging;
 
 import java.util.Arrays;
+import java.util.logging.Level;
 
 import io.quarkus.builder.item.MultiBuildItem;
 import io.quarkus.runtime.logging.LogCleanupFilterElement;
@@ -19,10 +20,16 @@ public LogCleanupFilterBuildItem(String loggerName, String... messageStarts) {
         if (messageStarts.length == 0) {
             throw new IllegalArgumentException("messageStarts cannot be null");
         }
-
         this.filterElement = new LogCleanupFilterElement(loggerName, Arrays.asList(messageStarts));
     }
 
+    public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, String... messageStarts) {
+        if (messageStarts.length == 0) {
+            throw new IllegalArgumentException("messageStarts cannot be null");
+        }
+        this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, Arrays.asList(messageStarts));
+    }
+
     public LogCleanupFilterElement getFilterElement() {
         return filterElement;
     }
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
index 4ddf8012481..fed4d7e04b1 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
@@ -65,6 +65,13 @@ void setUpDefaultLogCleanupFilters(List<LogCleanupFilterBuildItem> logCleanupFil
                             "quarkus.log.filter.\\"" + logCleanupFilter.getFilterElement().getLoggerName()
                                     + "\\".if-starts-with",
                             startsWithClause));
+            if (logCleanupFilter.getFilterElement().getTargetLevel() != null) {
+                configOutput.accept(
+                        new RunTimeConfigurationDefaultBuildItem(
+                                "quarkus.log.filter.\\"" + logCleanupFilter.getFilterElement().getLoggerName()
+                                        + "\\".target-level",
+                                logCleanupFilter.getFilterElement().getTargetLevel().toString()));
+            }
         }
     }
 
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
index 3a76d8748c5..afb95ee8a40 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
@@ -1,6 +1,7 @@
 package io.quarkus.runtime.logging;
 
 import java.util.List;
+import java.util.logging.Level;
 
 import io.quarkus.runtime.annotations.ConfigGroup;
 import io.quarkus.runtime.annotations.ConfigItem;
@@ -12,4 +13,10 @@ public class CleanupFilterConfig {
      */
     @ConfigItem(defaultValue = "inherit")
     List<String> ifStartsWith;
+
+    /**
+     * The new log level for the filtered message, defaults to DEBUG
+     */
+    @ConfigItem(defaultValue = "DEBUG")
+    Level targetLevel;
 }
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
index 90827335146..17f69775007 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
@@ -29,8 +29,12 @@ public boolean isLoggable(LogRecord record) {
         if (filterElement != null) {
             for (String messageStart : filterElement.getMessageStarts()) {
                 if (record.getMessage().startsWith(messageStart)) {
-                    record.setLevel(org.jboss.logmanager.Level.DEBUG);
-                    return Logger.getLogger(record.getLoggerName()).isDebugEnabled();
+                    record.setLevel(filterElement.getTargetLevel());
+                    if (filterElement.getTargetLevel().intValue() <= org.jboss.logmanager.Level.TRACE.intValue()) {
+                        return Logger.getLogger(record.getLoggerName()).isTraceEnabled();
+                    } else {
+                        return Logger.getLogger(record.getLoggerName()).isDebugEnabled();
+                    }
                 }
             }
         }
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
index 92bae5f8235..603dd14b115 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
@@ -1,13 +1,16 @@
 package io.quarkus.runtime.logging;
 
 import java.util.List;
+import java.util.logging.Level;
 
 public class LogCleanupFilterElement {
     private String loggerName;
     private List<String> messageStarts;
+    private Level targetLevel;
 
     // Required by recorder
     public LogCleanupFilterElement() {
+
     }
 
     public LogCleanupFilterElement(String loggerName, List<String> messageStarts) {
@@ -15,6 +18,12 @@ public LogCleanupFilterElement(String loggerName, List<String> messageStarts) {
         this.messageStarts = messageStarts;
     }
 
+    public LogCleanupFilterElement(String loggerName, Level targetLevel, List<String> messageStarts) {
+        this.loggerName = loggerName;
+        this.messageStarts = messageStarts;
+        this.targetLevel = targetLevel;
+    }
+
     public String getLoggerName() {
         return loggerName;
     }
@@ -27,7 +36,15 @@ public List<String> getMessageStarts() {
         return messageStarts;
     }
 
-    public void setMessageStart(List<String> messageStarts) {
+    public void setMessageStarts(List<String> messageStarts) {
         this.messageStarts = messageStarts;
     }
-}
\\ No newline at end of file
+
+    public Level getTargetLevel() {
+        return targetLevel;
+    }
+
+    public void setTargetLevel(Level targetLevel) {
+        this.targetLevel = targetLevel;
+    }
+}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
index d2f959e3a3c..31c8ad6175b 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
@@ -94,7 +94,8 @@ public void initializeLogging(LogConfig config, final List<RuntimeValue<Optional
         final Map<String, CleanupFilterConfig> filters = config.filters;
         List<LogCleanupFilterElement> filterElements = new ArrayList<>(filters.size());
         for (Entry<String, CleanupFilterConfig> entry : filters.entrySet()) {
-            filterElements.add(new LogCleanupFilterElement(entry.getKey(), entry.getValue().ifStartsWith));
+            filterElements.add(
+                    new LogCleanupFilterElement(entry.getKey(), entry.getValue().targetLevel, entry.getValue().ifStartsWith));
         }
 
         final ArrayList<Handler> handlers = new ArrayList<>(3 + additionalHandlers.size());
diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
index e033a145450..91aa1cc67ef 100644
--- a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
+++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
@@ -10,8 +10,10 @@
 import javax.inject.Singleton;
 
 import org.jboss.logging.Logger;
+import org.jboss.logmanager.Level;
 
 import io.netty.channel.EventLoopGroup;
+import io.netty.util.internal.PlatformDependent;
 import io.netty.util.internal.logging.InternalLoggerFactory;
 import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
 import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
@@ -26,6 +28,7 @@
 import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.UnsafeAccessedFieldBuildItem;
+import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
 import io.quarkus.netty.BossEventLoopGroup;
 import io.quarkus.netty.MainEventLoopGroup;
 import io.quarkus.netty.runtime.EmptyByteBufStub;
@@ -33,15 +36,15 @@
 
 class NettyProcessor {
 
-    @Inject
-    BuildProducer<ReflectiveClassBuildItem> reflectiveClass;
-
     private static final Logger log = Logger.getLogger(NettyProcessor.class);
 
     static {
         InternalLoggerFactory.setDefaultFactory(new JBossNettyLoggerFactory());
     }
 
+    @Inject
+    BuildProducer<ReflectiveClassBuildItem> reflectiveClass;
+
     @BuildStep
     public NativeImageSystemPropertyBuildItem limitMem() {
         //in native mode we limit the size of the epoll array
@@ -243,4 +246,12 @@ RuntimeInitializedClassBuildItem runtimeInitBcryptUtil() {
         // this holds a direct allocated byte buffer that needs to be initialised at run time
         return new RuntimeInitializedClassBuildItem(EmptyByteBufStub.class.getName());
     }
+
+    //if debug logging is enabled netty logs lots of exceptions
+    //see https://github.com/quarkusio/quarkus/issues/5213
+    @BuildStep
+    LogCleanupFilterBuildItem cleanup() {
+        return new LogCleanupFilterBuildItem(PlatformDependent.class.getName() + "0", Level.TRACE, "direct buffer constructor",
+                "jdk.internal.misc.Unsafe", "sun.misc.Unsafe");
+    }
 }