Skip to content

Could not start application logger error on Elixir 1.17.2 Erlang 27.0.1 #755

@samirbilalmemon

Description

@samirbilalmemon

I tried to implement Sentry 10.6.2 in my phoenix project and followed these steps.

In lib/myapp_web/endpoint.ex
use Sentry.PlugCapture at the start
plug Sentry.PlugContex after plug Plug.Parsers

In config/config.exs

config :logger,
  backends: [:console, Sentry.LoggerBackend],
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

config :sentry,
  dsn: System.get_env("SENTRY_DSN", ""),
  environment_name: Mix.env(),
  included_environments: [:prod, :dev],
  enable_source_code_context: true,
  root_source_code_paths: [File.cwd!()]

After I do this I get the following error on mix phx.server

10:02:54.599 [notice]     application: logger
    exited: {bad_return,
                {{'Elixir.Logger.App',start,[normal,[]]},
                 {'EXIT',
                     {badarg,
                         [{maps,from_list,
                              [[request_id]],
                              [{error_info,#{module => erl_stdlib_errors}}]},
                          {'Elixir.Enum',into_map,1,
                              [{file,"lib/enum.ex"},{line,1532}]},
                          {'Elixir.Logger.App',start,2,
                              [{file,"lib/logger/app.ex"},{line,40}]},
                          {application_master,start_it_old,4,
                              [{file,"application_master.erl"},
                               {line,295}]}]}}}}
    type: temporary


10:02:54.599 [error]   crasher:
    initial call: application_master:init/3
    pid: <0.6531.0>
    registered_name: []
    exception exit: {bad_return,
                     {{'Elixir.Logger.App',start,[normal,[]]},
                      {'EXIT',
                       {badarg,
                        [{maps,from_list,
                          [[request_id]],
                          [{error_info,#{module => erl_stdlib_errors}}]},
                         {'Elixir.Enum',into_map,1,
                          [{file,"lib/enum.ex"},{line,1532}]},
                         {'Elixir.Logger.App',start,2,
                          [{file,"lib/logger/app.ex"},{line,40}]},
                         {application_master,start_it_old,4,
                          [{file,"application_master.erl"},{line,295}]}]}}}}
      in function  application_master:init/3 (application_master.erl, line 143)
    ancestors: [application_controller,<0.10.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.6532.0>,normal}]
    links: [<0.45.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 29
    reductions: 77
  neighbours: []
** (Mix) Could not start application logger: exited in: Logger.App.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (ArgumentError) argument error
            (stdlib 6.0.1) :maps.from_list([:request_id])
            (elixir 1.17.2) lib/enum.ex:1532: Enum.into_map/1
            (logger 1.17.2) lib/logger/app.ex:40: Logger.App.start/2
            (kernel 10.0.1) application_master.erl:295: :application_master.start_it_old/4

I do not know where I am going wrong and would appreciate some help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions