无法使用自定义格式化程序
Cannot use custom-formatter
运行 java-11-openjdk-11.0.9.11-2.el8_3.x86_64, WildFly Core 10.1.12.SP1-redhat 。
我正在尝试使用这样的自定义格式化程序:
module add --name=com.my.keycloak.log-formatter-json --resources=/extensions/log-formatter-json.jar --dependencies=org.jboss.logmanager
/subsystem=logging/custom-formatter=custom:add(class=com.my.keycloak.logging.formatter.json.JsonFormatter, module=com.my.keycloak.log-formatter-json, properties={prettyPrint=true,printDetails=true,bufferSize=1024})
但总是出现以下错误:
16:41:29,921 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "logging"),
("custom-formatter" => "CUSTOM")
]): java.lang.IllegalArgumentException: Failed to load module "com.my.keycloak.log-formatter-json" for formatter "CUSTOM"
...
Caused by: java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoader
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ModuleFinder.getClassLoader(AbstractPropertyConfiguration.java:556) [jboss-logmanager-2.1.17.Final-redhat-00001.jar:2.1.17.Final-redhat-00001]
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:63) [jboss-logmanager-2.1.17.Final-redhat-00001.jar:2.1.17.Final-redhat-00001]
... 18 more
如果我尝试添加
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/jboss-modules.jar"
然后我得到:
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
at org.jboss.as.server.Main.main(Main.java:89)
at org.jboss.modules.Module.run(Module.java:352)
at org.jboss.modules.Module.run(Module.java:320)
at org.jboss.modules.Main.main(Main.java:593)
然后,我添加了
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
问题仍然存在。请帮忙。
P.S。如果您认为 JAVA_OPTS 没有更新,请查看 运行 期间记录的整个 JAVA_OPTS。
JBoss Bootstrap Environment
JBOSS_HOME: /opt/eap
JAVA: /usr/lib/jvm/java-11/bin/java
JAVA_OPTS: -server -Xlog:gc*:file="/opt/eap/standalone/log/gc.log":time,uptimemillis:filecount=5,filesize=3M -Xbootclasspath/a:/opt/eap/jboss-modules.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=256m -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -javaagent:/opt/jboss/container/jolokia/jolokia.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -Xbootclasspath/a:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.3.3.CP/org/jboss/logmanager/main/jboss-logmanager-2.1.17.Final-redhat-00001.jar:/opt/eap/modules/system/layers/base/org/glassfish/jakarta/json/main/jakarta.json-1.1.6.redhat-00001.jar:/opt/eap/modules/system/layers/base/javax/json/api/main/jakarta.json-api-1.1.6.redhat-00001.jar:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.3.3.CP/org/wildfly/common/main/wildfly-common-1.5.2.Final-redhat-00002.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dsun.util.logging.disableCallerCheck=true --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
您的错误是由 WFCORE-4748 中描述的问题引起的。这应该在 WildFly 21 中修复,并且应该在 JBoss EAP 7.4 中修复。
另一件需要注意的事情是没有必要像那样使用KeyCloak格式化程序。 JBoss EAP 7.3 中内置了一个,您似乎正在使用它。
/subsystem=logging/json-formatter=custom:add(pretty-print=true, print-details=true})
运行 java-11-openjdk-11.0.9.11-2.el8_3.x86_64, WildFly Core 10.1.12.SP1-redhat 。 我正在尝试使用这样的自定义格式化程序:
module add --name=com.my.keycloak.log-formatter-json --resources=/extensions/log-formatter-json.jar --dependencies=org.jboss.logmanager
/subsystem=logging/custom-formatter=custom:add(class=com.my.keycloak.logging.formatter.json.JsonFormatter, module=com.my.keycloak.log-formatter-json, properties={prettyPrint=true,printDetails=true,bufferSize=1024})
但总是出现以下错误:
16:41:29,921 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "logging"),
("custom-formatter" => "CUSTOM")
]): java.lang.IllegalArgumentException: Failed to load module "com.my.keycloak.log-formatter-json" for formatter "CUSTOM"
...
Caused by: java.lang.NoClassDefFoundError: org/jboss/modules/ModuleLoader
at org.jboss.logmanager.config.AbstractPropertyConfiguration$ModuleFinder.getClassLoader(AbstractPropertyConfiguration.java:556) [jboss-logmanager-2.1.17.Final-redhat-00001.jar:2.1.17.Final-redhat-00001]
at org.jboss.logmanager.config.AbstractPropertyConfiguration.<init>(AbstractPropertyConfiguration.java:63) [jboss-logmanager-2.1.17.Final-redhat-00001.jar:2.1.17.Final-redhat-00001]
... 18 more
如果我尝试添加
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JBOSS_HOME/jboss-modules.jar"
然后我得到:
java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanager.LogManager")
at org.jboss.logmanager.Logger.getLogger(Logger.java:57)
at org.jboss.as.server.Main.main(Main.java:89)
at org.jboss.modules.Module.run(Module.java:352)
at org.jboss.modules.Module.run(Module.java:320)
at org.jboss.modules.Main.main(Main.java:593)
然后,我添加了
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
问题仍然存在。请帮忙。
P.S。如果您认为 JAVA_OPTS 没有更新,请查看 运行 期间记录的整个 JAVA_OPTS。
JBoss Bootstrap Environment
JBOSS_HOME: /opt/eap
JAVA: /usr/lib/jvm/java-11/bin/java
JAVA_OPTS: -server -Xlog:gc*:file="/opt/eap/standalone/log/gc.log":time,uptimemillis:filecount=5,filesize=3M -Xbootclasspath/a:/opt/eap/jboss-modules.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=256m -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -javaagent:/opt/jboss/container/jolokia/jolokia.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -Xbootclasspath/a:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.3.3.CP/org/jboss/logmanager/main/jboss-logmanager-2.1.17.Final-redhat-00001.jar:/opt/eap/modules/system/layers/base/org/glassfish/jakarta/json/main/jakarta.json-1.1.6.redhat-00001.jar:/opt/eap/modules/system/layers/base/javax/json/api/main/jakarta.json-api-1.1.6.redhat-00001.jar:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.3.3.CP/org/wildfly/common/main/wildfly-common-1.5.2.Final-redhat-00002.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dsun.util.logging.disableCallerCheck=true --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
您的错误是由 WFCORE-4748 中描述的问题引起的。这应该在 WildFly 21 中修复,并且应该在 JBoss EAP 7.4 中修复。
另一件需要注意的事情是没有必要像那样使用KeyCloak格式化程序。 JBoss EAP 7.3 中内置了一个,您似乎正在使用它。
/subsystem=logging/json-formatter=custom:add(pretty-print=true, print-details=true})