{"id":16415426,"url":"https://github.com/jonathanperret/logger_lager_backend","last_synced_at":"2025-10-10T04:10:05.069Z","repository":{"id":48301022,"uuid":"55525859","full_name":"jonathanperret/logger_lager_backend","owner":"jonathanperret","description":"A Logger backend that forwards messages to lager","archived":false,"fork":false,"pushed_at":"2021-08-02T15:59:28.000Z","size":16,"stargazers_count":12,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T20:21:16.588Z","etag":null,"topics":["elixir","lager","logging"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanperret.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-05T16:55:35.000Z","updated_at":"2024-03-28T07:46:58.000Z","dependencies_parsed_at":"2022-09-26T18:01:35.278Z","dependency_job_id":null,"html_url":"https://github.com/jonathanperret/logger_lager_backend","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperret%2Flogger_lager_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperret%2Flogger_lager_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperret%2Flogger_lager_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanperret%2Flogger_lager_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanperret","download_url":"https://codeload.github.com/jonathanperret/logger_lager_backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244733731,"owners_count":20501012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","lager","logging"],"created_at":"2024-10-11T07:05:41.158Z","updated_at":"2025-10-10T04:10:00.030Z","avatar_url":"https://github.com/jonathanperret.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoggerLagerBackend\n\nA `lager` (https://github.com/erlang-lager/lager) backend for Elixir's `Logger`\n(https://hexdocs.pm/logger/Logger.html).\n\nThat is, it routes messages generated with `Logger.\u003clevel\u003e()` to `lager`. This\nis useful if you have a mixed Erlang/Elixir project and have decided to\nstandardize on `lager` as a logging framework.\n\nKnown limitations:\n* You're on your own to configure and start `lager`.\n* Only `lager`'s default sink (`:lager_event`) is used.\n* Performance is probably not ideal - all messages received are sent to `lager`\n  regardless of the configured level and `lager`'s compile-time optimization\n  does not happen. However, `Logger` will still do its own optimization\n  upstream of this backend.\n* Metadata is passed straight from `Logger` to `lager`, hoping that the keys\n  match. It seems to be the case for the basics (`module`, `function`...) but\n  may need looking into.\n\n## Installation\n\nAdd `logger_lager_backend` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:logger_lager_backend, \"~\u003e 0.1.0\"}]\nend\n```\n\n## Configuration\n\nInstruct `Logger` to use `logger_lager_backend`:\n\n```elixir\nconfig :logger,\n  backends: [LoggerLagerBackend],\n  handle_otp_reports: false,\n  level: :debug\n```\n\nThis sends all messages of level `debug` or higher to `lager`. They will then\nbe subject to filtering and routing according to whichever `lager` config you\nhave in place.\n\nWe also use `handle_otp_reports: false` to avoid having messages from the\nErlang's built-in `error_logger` module appear twice in the output.\n\n## Troubleshooting\n\n### `FORMAT ERROR`s in log\n\nIf you get `FORMAT ERROR` messages like this one:\n\n```text\nFORMAT ERROR: \"~s\" [[\u003c\u003c\"GenServer :redis_sub_0_8 terminating\"\u003e\u003e,\u003c\u003c\"\\n** (stop) \"\u003e\u003e|\u003c\u003c\":redis_down\"\u003e\u003e]\n```\n\nYou're probably hitting [erlang-lager/lager#326](https://github.com/erlang-lager/lager/issues/326). Upgrade\n`lager` to `3.2.0` or more recent.\n\n### `Elixir.Logger.Supervisor` error on startup\n\nIf you get the following message on startup:\n\n```text\n[error] Supervisor 'Elixir.Logger.Supervisor' had child 'Elixir.Logger.ErrorHandler' started with\n  'Elixir.Logger.Watcher':watcher(error_logger, 'Elixir.Logger.ErrorHandler',\n  {true,false,500}, link) at \u003c0.422.0\u003e exit with reason normal in context child_terminated\n```\n\nMake sure the `:lager` application is started before `:logger`, by putting\n`:lager` first in your `applications` list in `mix.exs`:\n\n```elixir\ndef application do\n  [applications: [:lager, :logger, …],\n   mod: {MyApp, []}]\nend\n```\n\n## Related projects\n\n* [lager_logger](https://github.com/PSPDFKit-labs/lager_logger) does the\n  opposite of this backend: it sends `lager` messages to `Logger`.\n* [exlager](https://github.com/khia/exlager) offers an Elixir frontend to\n  `lager`, which can be an alternative to this backend if you control all the\n  code that does logging. But if you are using e.g. `Ecto`, which writes to\n  `Logger`, `exlager` will not help you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanperret%2Flogger_lager_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanperret%2Flogger_lager_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanperret%2Flogger_lager_backend/lists"}