Fl4m3Ph03n1x

Fl4m3Ph03n1x

Cannot start application Logger

Background

I have an app that I am trying to start via iex -S mix, but I am unable to.

Error

Upon running the previous command I get the following error:

** (Mix) Could not start application logger: Logger.App.start(:normal, []) returned an error: shutdown: failed to start child: Logger.BackendSupervisor
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {{{:case_clause, {:EXIT, {:undef, [{LoggerFileBackend, :init, [{LoggerFileBackend, :deals_logger}], []}, {:gen_event, :server_add_handler, 4, [file: 'gen_event.erl', line: 473]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 318]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}, [{Logger.Watcher, :init, 1, [file: 'lib/logger/watcher.ex', line: 28]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}, {:child, :undefined, {LoggerFileBackend, :deals_logger}, {Logger.Watcher, :start_link, [{Logger, {LoggerFileBackend, :deals_logger}, {LoggerFileBackend, :deals_logger}}]}, :transient, 5000, :worker, [Logger.Watcher]}}}
            (logger) lib/logger/backend_supervisor.ex:14: anonymous fn/2 in Logger.BackendSupervisor.start_link/1
            (elixir) lib/enum.ex:1940: Enum."-reduce/3-lists^foldl/2-0-"/3
            (logger) lib/logger/backend_supervisor.ex:13: Logger.BackendSupervisor.start_link/1
            (stdlib) supervisor.erl:379: :supervisor.do_start_child_i/3
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
            (stdlib) supervisor.erl:1157: :supervisor.children_map/4
            (stdlib) supervisor.erl:315: :supervisor.init_children/2
            (stdlib) gen_server.erl:374: :gen_server.init_it/2
            (stdlib) gen_server.erl:342: :gen_server.init_it/6
            (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

My project has several dependencies, some of them from private git repositories that also use logger, but I never had this issue and I added logger to the extra_applications part of the mix.exs file.

extra_applications: [:logger, :runtime_tools, :some_app]

Versions:

elixir 1.8.1-otp-21
erlang 21.2

What could be causing this?

Marked As Solved

josevalim

josevalim

Creator of Elixir

I have also improved the error in master. For an invalid backend OMG, it will now say:

** (Mix) Could not start application logger: Logger.App.start(:normal, []) returned an error: shutdown: failed to start child: Logger.BackendSupervisor
    ** (EXIT) an exception was raised:
        ** (RuntimeError) EXIT when installing backend OMG: an exception was raised:
    ** (UndefinedFunctionError) function OMG.init/1 is undefined (module OMG is not available)
        OMG.init(OMG)
        (stdlib) gen_event.erl:473: :gen_event.server_add_handler/4
        (stdlib) gen_event.erl:318: :gen_event.handle_msg/6
        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Also Liked

NobbZ

NobbZ

This is not part of the regular :logger application. Perhaps you are missing :logger_file_backend in your list of dependencies? Or you simply need to remove that backend from your configuration.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
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
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement