简体   繁体   中英

How to configure logger format in mix elixir project?

I have an elixir mix project and I am not sure how to configure log format. Below is my configuration:

config :logger, backends: [{LoggerFileBackend, :error_log}], format: "$date $time [$level] $levelpad$message\n"

what I want is to show date, time level in the log file but the log doesn't have date :

15:49:06.384 [info] The Sample is launching: /users/joeyzhao/dev/test1. In space, no one can hear. 15:49:06.384 [info] Elixer version: (1.6.5) 15:49:06.397 [info] Environment ...

I use below code to log:

require Logger ... Logger.info("...")

Is there anything wrong with my logger config?

That's the drawback of configuration being loaded on compilation time . You have to recompile logger_file_backend to reflect changes in your app's configuration files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM