estk/log4rs

Logging pattern does not depict logs as I declared it

EvilWatermelon opened this issue · 3 comments

I want that my log looks like this:

2024-05-02T10:45:28 [INFO] actix_server::server - Actix runtime found; starting in Actix runtime

But that does not work and looks like this:

2024-05-02T10:45:28.658835804+02:00 INFO actix_server::server - Actix runtime found; starting in Actix runtime

And I also want to use colors but that does not work either. What am I doing wrong?

appenders:
  stdout:
    kind: console
  requests:
    kind: threshhold
    encoder:
      kind: pattern
      pattern: "{h(%Y-%m-%d %H:%M:%S)} | {({l}):5.5} | [{f}:{L}] — {m}{n}"
      level_colors:
        INFO: Green
        WARN: Yellow
        ERROR: Red
        DEBUG: Orange
root:
  level: debug
  appenders:
    - stdout
loggers:
  app::requests:
    level: info
    appenders:
      - requests
    additive: true
  1. Colors: We don't yet support modifying the highlight scheme. Here's an old PR that started the process: #224
  2. It looks like the only issue is related to the formatting of seconds? It looks like the crate we use to format time may have had some modifications. I'll take a look.

@EvilWatermelon I took a look and chrono has not changed their formatting. I ran some tests and believe "{h({d(%Y-%m-%d %H:%M:%S)} [{l:<5.5}] {M} - {m})}{n}" is the pattern you're looking for. I used the compile_time_config example to test it.

@EvilWatermelon Please close this if you're all set