Skip to content

Logger.Translator.child_info/2 fails on supervisor reports including :name #7889

@arkgil

Description

@arkgil

Hi there! I have a problem with Logger.Translator failing on supervisor reports with Elixir 1.6.6.

Environment

  • Elixir & Erlang/OTP versions (elixir --version): 1.6.6 & 20.3 (or 19.3)
  • Operating system: macOS High Sierra 10.13.1

Current behavior

Logger.Translator.child_info/2 fails on supervisor progress reports which include a name of the process, e.g. the one reported by supervisor3 - https://github.com/klarna/supervisor3/blob/master/src/supervisor3.erl#L1656.

The error looks as follows:

15:35:56.711 [error] :gen_event handler Logger.ErrorHandler installed at :error_logger
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Logger.Translator.child_info/2
        (logger) lib/logger/translator.ex:320: Logger.Translator.child_info(:debug, [name: LoggerTranslatorRepro.Server, mfargs: {Agent, :start_link, [#Function<0.78284505/0 in LoggerTranslatorRepro.init/1>, [name: LoggerTranslatorRepro.Server]]}, restart_type: :permanent, shutdown: 5000, child_type: :worker])
        (logger) lib/logger/translator.ex:240: Logger.Translator.report_supervisor_progress/2
        (logger) lib/logger/erlang_handler.ex:104: Logger.ErlangHandler.translate/6
        (logger) lib/logger/erlang_handler.ex:97: Logger.ErlangHandler.translate/5
        (logger) lib/logger/error_handler.ex:93: Logger.ErrorHandler.log_event/6
        (logger) lib/logger/error_handler.ex:33: Logger.ErrorHandler.handle_event/2
        (stdlib) gen_event.erl:574: :gen_event.server_update/4
        (stdlib) gen_event.erl:556: :gen_event.server_notify/4

This happens on Elixir 1.6.6, I couldn't observe this error on 1.5.3. Most probably the issue was introduced in the PR bringing integration with Erlang 21 logger, this deletion removed the clause which handled the name of the child process.

If anyone's interested, here is the repo to reproduce the error.

Expected behavior

Logger.Translator properly handles and prints out progress reports with process names.

I'll be happy to prepare a PR for this, if it's not intentional. If the change was intentional, maybe a good idea would be to log a warning when translator receives the report it can't handle?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions