alanj853

alanj853

Application.stop/1 calls not being reported by :error_logger in Elixir 1.15.0

Hi,

I have noticed that Application.stop/1 calls are no longer being reported by erlang’s :error_logger in the same way with version 1.15.0. It was working with version 1.14.5.

See this sample module for an example. I use poison as the application to stop, but it could be any application that has started:

defmodule GenEventTester do
  @moduledoc """
  Documentation for `GenEventTester`.
  """
  @behaviour :gen_event
  require Logger

  @impl :gen_event
  def init(_) do
    Logger.notice("init/1 has been called")
    {:ok, %{}}
  end

  @impl :gen_event
  def handle_event(msg, state) do
    Logger.notice("handle_event/2 has been called: #{inspect(msg)}")
    {:ok, state}
  end

  @impl :gen_event
  def handle_call(msg, state) do
    Logger.notice("handle_call/2 has been called: #{inspect(msg)}")
    {:ok, :ok, state}
  end
end

Running this with Elixir 1.14.5:

Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

==> poison
Compiling 4 files (.ex)
Generated poison app
==> gen_event_tester
Compiling 1 file (.ex)
Generated gen_event_tester app
Interactive Elixir (1.14.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :error_logger.add_report_handler GenEventTester, []

09:08:57.338 [notice] init/1 has been called
:ok
iex(2)> Application.stop :poison

09:09:08.441 [notice] handle_event/2 has been called: {:info_report, #PID<0.70.0>, {#PID<0.44.0>, :std_info, [application: :poison, exited: :stopped, type: :temporary]}}
:ok

09:09:08.441 [notice] Application poison exited: :stopped
iex(3)>

Running this with Elixir 1.15.0:

Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :error_logger.add_report_handler GenEventTester, []

09:10:53.747 [notice] init/1 has been called
:ok
iex(2)>  Application.stop :poison

09:11:08.419 [notice] Application poison exited: :stopped
:ok
iex(3)>

Interestingly, the gen_event behaviour is being used somewhat, as the init/1 callback is called.

Does anybody know how to get the handle_event/2 callbacks to be called with Elixir 1.15.0, and/or know why this is happening?

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement