In order to get this working with spring boot I had to do a number of things.
First, since I'm logging via log4j2 I needed log4j-jul and log4j-jpl artifacts. If you're not using spring boot additional steps may be required. note: jul is actually in the spring-boot-starter-log4j2 but jpl is not.
libs.versions.toml
[versions]
spring = "3.+"
[libraries]
spring-bom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring" }
starter-log4j2 = { module = "org.springframework.boot:spring-boot-starter-log4j2" }
log4j-jpl = { module = "org.apache.logging.log4j:log4j-jpl" }
log4j-jul = { module = "org.apache.logging.log4j:log4j-jul" }
The first was I had to enable http client logging via gradle, this doesn't seem to get picked up via application.properties in gradle.
build.gradle.kts
dependencies {
runtimeOnly(platform(libs.spring.bom))
runtimeOnly(libs.starter.log4j2)
testRuntimeOnly(libs.log4j.jpl)
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
replacedBy(
"org.springframework.boot:spring-boot-starter-log4j2",
"Use Log4j2 instead of Logback",
)
}
}
}
tasks.withType<Test>().configureEach {
systemProperty("jdk.httpclient.HttpClient.log", "all")
}
Then, even if your root logger is set to info.
application.properties
logging.level.jdk.httpclient = info
If you aren't using spring boot, gradle, or log4j2 you'll need to change these in different places.
note: I haven't figured out what logs frames but this was confusing
-Djdk.httpclient.HttpClient.log=
errors,requests,headers,
frames[:control:data:window:all],content,ssl,trace,channel,all
you can put frames,all or frames:data,all. This needs to be "first" from the looks of the code (or maybe just on a newline), but the code uses startsWith and then it splits on : or uses frames:all by default. using the square brackets like above seems to confuse the parser.
Even with with this set properly frames was never called and I don't understand when it would be enough to know why.