not really a 4k question but probable you've had t...
# http4k
a
not really a 4k question but probable you've had to deal with it: Trying to test my 4k server using the 4k
ApacheClient()
... which is stuck on "DEBUG" log level and thus prints huge amounts of output. Tried to change with
(LoggerFactory.getLogger(ApacheClient::class.java) as ch.qos.logback.classic.Logger).level = Level.ERROR
but no luck. Any ideas on changing the client log level? Thanks.
OK, that line almost works. But you need to use a string name
"org.apache.http"
rather than the class, and you MUST place it in its own function annotated with
@BeforeClass
(or just
@Before
).
Copy code
@Before fun setupLogging() {
  (LoggerFactory.getLogger("org.apache.http") as ch.qos.logback.classic.Logger).level = <http://Level.INFO|Level.INFO>
}
d
Ah logging - such a joy on the JVM! There's a reason that we just default to stdout... 🙂 .
f
I tend to add a
logback-test.xml
file to the test resources directory, with some some simple config to log to console at INFO level. That means I can control all logging in one place for all tests without having to do that in code.
1
👍 2