CaliDog/certstream-server

How to output log to file instead of console

Closed this issue · 1 comments

Hi, how do I output log to file?

I see there is an option to set in https://github.com/CaliDog/certstream-server/blob/master/config/config.exs#L10, but I don't know to change :console to file.

Thank you.

I believe the elixir Logger module doesn't have support for writing to a file, but you can always do something like run your program and output to a file using unix pipe redirects.

Something like mix run --no-halt > yourlogfile.log should do it.

If that doesn't produce the desired output, maybe mix run --no-halt 2>&1 > yourlogfile.log will?

Otherwise looks like someone wrote a file output backend for the native logger here - https://github.com/onkel-dirtus/logger_file_backend and I'd happily review a PR.