Exlir.Logger.Supervisor "exit with reason normal in context child_terminated" (newbie)

871 views
Skip to first unread message

matteo brancaleoni

unread,
May 24, 2015, 2:17:16 PM5/24/15
to elixir-l...@googlegroups.com
Hi!

I started a personal project and want to use Elixir to learn a new language.

I'm completely new to Erlang/Elixir , having just a python background.

Right now I'm integrating the socket-can erlang library
https://github.com/tonyrog/can ) with my sample elixir module and
they speak each other happily. So far, so good :)

I've a strange error when starting the can application which I cannot understand:

Interactive Elixir (1.0.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Detectino.start_link
20:02:45.155 [error] Supervisor 'Elixir.Logger.Supervisor' had child 'Elixir.Logger.ErrorHandler' started with 'Elixir.Logger.Watcher':watcher(error_logger, 'Elixir.Logger.ErrorHandler', {true,false,500}, link) at <0.97.0> exit with reason normal in context child_terminated
20:02:45.187 [info] Application lager started on node nonode@nohost
20:02:45.192 [info] Application can started on node nonode@nohost

(Detectino is my module, the can erlang application uses lager as logger) 

Everything seems to work ok, even Logger is ok to me (I can use it after the error),
but I don't like those messages and not understanding what's going ok.

Any pointer to understand what is happening?

Thanks a lot,
Matteo

matteo brancaleoni

unread,
May 24, 2015, 5:48:15 PM5/24/15
to elixir-l...@googlegroups.com
Well,

seems a conflict between Logger and :lager .

But using https://hex.pm/packages/lager_logger and forcing some deps in my mix.exs file, like:

      {:can, git: "https://github.com/tonyrog/can.git"},
      {:lager, git: "git://github.com/Feuerlabs/lager.git", override: true},
      {:lager_logger, git: "https://github.com/PSPDFKit-labs/lager_logger"}

makes everything ok :)

But if anyone has a brief explanation on why the two loggers conflicts, is more than welcome :)

Sascha Kattelmann

unread,
May 2, 2016, 6:33:01 AM5/2/16
to elixir-lang-talk
I have the same problem and can't figure out what's the cause of this. Everything seems to work, it is just the logline that is annoying:

Supervisor 'Elixir.Logger.Supervisor' had child undefined started with 'Elixir.Logger.Watcher':watcher(error_logger, 'Elixir.Logger.ErrorHandler', {false,false,500}, link) at <0.955.0> exit with reason normal in context child_terminated

I want to use lager only, so I really don't want to use your approach of forwarding lager logs to the elixir logger. In my case logger was kind of 'forced' into my application through libraries. Some help is highly appreciated :)

José Valim

unread,
May 2, 2016, 7:33:49 AM5/2/16
to elixir-l...@googlegroups.com
If the error is coming from the error handler, you can simply disable the error handler for Elixir:

config :logger, handle_otp_reports: false



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/feaf4ce2-f8b5-453b-8549-124dd300336b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Valim

unread,
May 2, 2016, 7:39:56 AM5/2/16
to elixir-lang-talk, jose....@plataformatec.com.br
Actually, I think the error is something else. It seems Lager is disabling Elixir's logger? But then the supervisor kicks back in and adds it back. In any case, my previous e-mail should just work if you want Erlang errors to be logged by lager and not Elixir's Logger. :)


On Monday, May 2, 2016 at 1:33:49 PM UTC+2, José Valim wrote:
If the error is coming from the error handler, you can simply disable the error handler for Elixir:

config :logger, handle_otp_reports: false



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Mon, May 2, 2016 at 12:33 PM, 'Sascha Kattelmann' via elixir-lang-talk <elixir-lang-talk@googlegroups.com> wrote:
I have the same problem and can't figure out what's the cause of this. Everything seems to work, it is just the logline that is annoying:

Supervisor 'Elixir.Logger.Supervisor' had child undefined started with 'Elixir.Logger.Watcher':watcher(error_logger, 'Elixir.Logger.ErrorHandler', {false,false,500}, link) at <0.955.0> exit with reason normal in context child_terminated

I want to use lager only, so I really don't want to use your approach of forwarding lager logs to the elixir logger. In my case logger was kind of 'forced' into my application through libraries. Some help is highly appreciated :)

On Sunday, May 24, 2015 at 11:48:15 PM UTC+2, matteo brancaleoni wrote:
Well,

seems a conflict between Logger and :lager .

But using https://hex.pm/packages/lager_logger and forcing some deps in my mix.exs file, like:

      {:can, git: "https://github.com/tonyrog/can.git"},
      {:lager, git: "git://github.com/Feuerlabs/lager.git", override: true},
      {:lager_logger, git: "https://github.com/PSPDFKit-labs/lager_logger"}

makes everything ok :)

But if anyone has a brief explanation on why the two loggers conflicts, is more than welcome :)

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-talk+unsubscribe@googlegroups.com.

Sascha Kattelmann

unread,
May 2, 2016, 7:49:42 AM5/2/16
to elixir-lang-talk, jose....@plataformatec.com.br
Thanks for the quick reply! I already had the handle_otp_reports option disabled (see the {false,false,500} part in the log message?). So that does not seem to help. Btw lager is working fine, it is really just the log message which I want to fix. 


On Monday, May 2, 2016 at 1:39:56 PM UTC+2, José Valim wrote:
Actually, I think the error is something else. It seems Lager is disabling Elixir's logger? But then the supervisor kicks back in and adds it back. In any case, my previous e-mail should just work if you want Erlang errors to be logged by lager and not Elixir's Logger. :)

On Monday, May 2, 2016 at 1:33:49 PM UTC+2, José Valim wrote:
If the error is coming from the error handler, you can simply disable the error handler for Elixir:

config :logger, handle_otp_reports: false



José Valim
Skype: jv.ptec
Founder and Director of R&D

On Mon, May 2, 2016 at 12:33 PM, 'Sascha Kattelmann' via elixir-lang-talk <elixir-l...@googlegroups.com> wrote:
I have the same problem and can't figure out what's the cause of this. Everything seems to work, it is just the logline that is annoying:

Supervisor 'Elixir.Logger.Supervisor' had child undefined started with 'Elixir.Logger.Watcher':watcher(error_logger, 'Elixir.Logger.ErrorHandler', {false,false,500}, link) at <0.955.0> exit with reason normal in context child_terminated

I want to use lager only, so I really don't want to use your approach of forwarding lager logs to the elixir logger. In my case logger was kind of 'forced' into my application through libraries. Some help is highly appreciated :)

On Sunday, May 24, 2015 at 11:48:15 PM UTC+2, matteo brancaleoni wrote:
Well,

seems a conflict between Logger and :lager .

But using https://hex.pm/packages/lager_logger and forcing some deps in my mix.exs file, like:

      {:can, git: "https://github.com/tonyrog/can.git"},
      {:lager, git: "git://github.com/Feuerlabs/lager.git", override: true},
      {:lager_logger, git: "https://github.com/PSPDFKit-labs/lager_logger"}

makes everything ok :)

But if anyone has a brief explanation on why the two loggers conflicts, is more than welcome :)

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.

José Valim

unread,
May 2, 2016, 7:54:34 AM5/2/16
to Sascha Kattelmann, elixir-lang-talk
Oops, forgot to reply to all.

So what I think what is happening is that Elixir is adding its error logger handler and lager is removing it on initialization. I think there are a couple ways to solve this:

1. IIRC lager has an optional to list which handlers it should not remove. You could pass it

2. Start lager before logger

3. Add a patch to Elixir so it doesn't add its error handler when none of otp or sasl are meant to be captured



José Valim
Skype: jv.ptec
Founder and Director of R&D

Sascha Kattelmann

unread,
May 2, 2016, 8:10:44 AM5/2/16
to elixir-lang-talk, skatt...@googlemail.com, jose....@plataformatec.com.br
Point 2. worked for me. But you have to be very careful about the lager backends, they must also be started before the elixir logger! Thanks José!
Reply all
Reply to author
Forward
0 new messages