标签: logbook

如何在 Spring Boot 应用程序中实例化日志

我有一个简单的 Spring boot 应用程序,logbook-spring-boot-starter依赖于日志库。

该文件指出,要忽略健康检查请求,请像这样连接日志:

Logbook logbook = Logbook.builder()
    .condition(exclude(
        requestTo("/health"),
        requestTo("/admin/**"),
        contentType("application/octet-stream"),
        header("X-Secret", newHashSet("1", "true")::contains)))
    .build();
Run Code Online (Sandbox Code Playgroud)

这听起来可能很天真,但我不知道应该在哪里连接它。我应该将它放在带有特定注释的任何特定类或方法中吗?举个例子会有帮助。

java spring spring-boot logbook

6
推荐指数
1
解决办法
1万
查看次数

pytest日志记录到文件和stdout

I'm trying to setup logbook in a PyTest test to output everything to both stderr and a file. The file should get every log level, but stderr should have a higher threshold (which PyTest will manage with it's usual capture settings).

I've got the pytest-logbook plugin. That redirects stderr into PyTest capture, but I'm not sure how to add the file output.

This is (hopefully) obvious to someone that knows logbook, but it's new to me.

One more thing, I …

python pytest logbook

4
推荐指数
1
解决办法
2256
查看次数

标签 统计

logbook ×2

java ×1

pytest ×1

python ×1

spring ×1

spring-boot ×1