【问题标题】:How to write one-line logs with tinylog 2?如何用 tinylog 2 写一行日志?
【发布时间】:2020-10-25 19:13:59
【问题描述】:

我正在使用https://tinylog.org/v2/ 进行日志记录。

默认情况下,框架将每个语句记录在两行中

2020-10-25 20:07:27 [main] org.reflections.Reflections.scan()
INFO: Reflections took 288 ms to scan 1 urls, producing 5 keys and 22 values 

如何避免这种行为?首选的解决方案是程序化解决方案

【问题讨论】:

    标签: java logging tinylog


    【解决方案1】:

    您可以通过Configuration class 以编程方式为您的日志条目设置格式模式。

    例子:

    Configuration.set("writer", "console");
    Configuration.set("writer.format", "{date} [{thread}] {class}.{method}() {level}: {message}");
    

    【讨论】:

      猜你喜欢
      • 2017-09-25
      • 1970-01-01
      • 2015-08-27
      • 1970-01-01
      • 2015-06-04
      • 2020-10-06
      • 2017-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多