smpallen99 / syslog

Elixir logger syslog backend
MIT License
40 stars 22 forks source link

Error response from init causes Logger to crash #12

Closed sdball closed 8 years ago

sdball commented 8 years ago

With syslog integrated and configured my application fails to boot. It looks like the error response from init is not playing nicely with Logger:

** (Mix) Could not start application logger: Logger.App.start(:normal, []) returned an error: shutdown: failed to start child: Logger.Watcher
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:error, {:undef, [{Logger.Backends.Syslog, :init, [Logger.Backends.Syslog], []}, {GenEvent, :do_handler, 3, [file: 'lib/gen_event.ex', line: 1101]}, {GenEvent, :do_add_handler, 5, [file: 'lib/gen_event.ex', line: 1058]}, {GenEvent, :handle_msg, 5, [file: 'lib/gen_event.ex', line: 726]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}

In init it looks like an error is returned unless there is a registered process called :user but I don't see any code that would make it or docs detailing what it's expected to be.

My configuration is:

config :logger,
  # compile_time_purge_level: :error,
  level: :debug,
  utc_log: true,
  handle_otp_reports: true,
  handle_sasl_reports: true,
  backends: [Logger.Backends.Syslog],
  syslog: [facility: :local1, appid: "myapp", host: "build", port: 514]
smpallen99 commented 8 years ago

try setting :host like this: host: '127.0.0.1'

Also, did you put :syslog in your applications function in mix.exs?

Steve

sdball commented 8 years ago

Aha! I had a couple things wrong.