Koszal
The bash script below generates and umbrela project (mix new --umbrella logcfg) and then an app (mix new demo). It then creates a task and adjusts config for the :default logger. Finally, everything is compiled and the generated task runs. (mix hello). Despite setting :type and :filesync_repeat_interval in the config, the logger still sees the default values:
19:07:52.772 [warning] config.type :standard_io
19:07:52.773 [warning] config.type :no_repeat
Why?
Elixir 1.15.7 (compiled with Erlang/OTP 26)
Koszal
#!/bin/bash
mkdir /tmp/logger-$$
cd /tmp/logger-$$
mix new --umbrella logcfg
cd logcfg
dsn=`pwd`
cd $dsn/apps
mix new demo
mkdir -p $dsn/apps/demo/lib/mix
cat <<TASK > $dsn/apps/demo/lib/mix/hello.ex
defmodule Mix.Tasks.Hello do
use Mix.Task
require Logger
def run(_) do
:logger.get_handler_config(:default) |> IO.inspect()
{:ok, lcfg} = :logger.get_handler_config(:default)
Logger.warning( "config.type #{ inspect(lcfg[:config][:type]) }" )
Logger.warning( "config.filesync_repeat_interval #{ inspect(lcfg[:config][:filesync_repeat_interval]) }" )
end
end
TASK
cat <<CONFIG >> $dsn/config/config.exs
config :logger, :default,
config: [
type: :standard_error,
filesync_repeat_interval: 5000
]
CONFIG
cd $dsn
mix compile
mix hello
pwd
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
cmo
Do you need to configure
default_handler, notdefault?Here is a working config for file logging:
Koszal
I had tried that before (and a few other things) and it still said
So you either have an older Elixir version (there were changes to the logging mechanism), or it does not work in the context of the task, or there is something else I don’t understand…
Have you run the bash script after changing
defaulttodefault_handler? What does it print?K.
cmo
I’m in 1.16.3 and sorry but I won’t be running your bash script.
hauleth
If you are using OTP 24+ and you aware of the consequences, then you can run
logger:reconfigure/0as part of your startup script. In general default handler is only partially configurable after it started.Koszal
You seem to apply I need some black magic whereas in fact I just want to figure out how to configure basic properties of the logger.
I have followed Elixir documentation at
It tells you to put the settings in
config/config.exsand gives a snippet of code.My current config is
I have also tried config at the application level:
Nothing seems to affect the logging. The log file is not created, messages appear on stdout (rather than stderr), etc.
K.
cmo
why do you have this there if you’re trying to log to a file? Have you tried removing that or using
:fileas per the docs?Koszal
Yes.
You can trivially check yourself -
hauleth
Answer adequate to your post:
I have tested, without
:typefield it worked perfectly.