mirror of https://github.com/apache/jmeter.git
Fix log4j package warning on JMeter startup: WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated ...
The Log4j Core `packages` configuration attribute is deprecated because: * It triggers the scanning of the mentioned packages and slows down the startup process. * It was replaced in version 2.0 by a faster mechanism that relies on a `Log4jPlugins.dat` metadata file. See [Log4j Plugins](https://logging.apache.org/log4j/2.x/manual/plugins.html) for more details. This PR removes the `packages` attribute from the standard configuration file and configures the build script of `jmeter-core` to use the `PluginProcessor` contained in `log4j-core`. See #5937.
This commit is contained in:
parent
174ba3178f
commit
cbdfd1ba43
|
@ -16,7 +16,7 @@
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Configuration status="WARN" packages="org.apache.jmeter.gui.logging">
|
<Configuration status="WARN">
|
||||||
|
|
||||||
<Appenders>
|
<Appenders>
|
||||||
<!-- Uncomment to set rotating logs up to 5 files of 100 MB-->
|
<!-- Uncomment to set rotating logs up to 5 files of 100 MB-->
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import com.github.autostyle.gradle.AutostyleTask
|
import com.github.autostyle.gradle.AutostyleTask
|
||||||
import com.github.vlsi.gradle.ide.IdeExtension
|
import com.github.vlsi.gradle.ide.IdeExtension
|
||||||
|
import java.util.jar.JarFile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java-test-fixtures")
|
id("java-test-fixtures")
|
||||||
|
@ -45,6 +46,9 @@ dependencies {
|
||||||
api("org.apache.logging.log4j:log4j-core") {
|
api("org.apache.logging.log4j:log4j-core") {
|
||||||
because("GuiLogEventAppender is using log4j-core to implement GUI-based log appender")
|
because("GuiLogEventAppender is using log4j-core to implement GUI-based log appender")
|
||||||
}
|
}
|
||||||
|
kapt("org.apache.logging.log4j:log4j-core") {
|
||||||
|
because("Generates a plugin cache file for GuiLogEventAppender")
|
||||||
|
}
|
||||||
api("org.apache.logging.log4j:log4j-slf4j-impl") {
|
api("org.apache.logging.log4j:log4j-slf4j-impl") {
|
||||||
because("Both log4j and slf4j are included, so it makes sense to just add log4j->slf4j bridge as well")
|
because("Both log4j and slf4j are included, so it makes sense to just add log4j->slf4j bridge as well")
|
||||||
}
|
}
|
||||||
|
@ -188,3 +192,16 @@ tasks.jar {
|
||||||
from("$rootDir/xdocs/images/logo.svg")
|
from("$rootDir/xdocs/images/logo.svg")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks the generated JAR for a Log4j plugin cache file.
|
||||||
|
tasks.jar {
|
||||||
|
doLast {
|
||||||
|
val jarFile = archiveFile.get().asFile
|
||||||
|
JarFile(jarFile).use { jar ->
|
||||||
|
val entryName = "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat"
|
||||||
|
if (jar.getJarEntry(entryName) == null) {
|
||||||
|
throw IllegalStateException("$entryName was not found in $jarFile. The entry should be generated by log4j-core annotation processor")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue