ArgumentError : the table identifier does not refer to an existing ETS table

I generated an app with mix new evenbot --sup

Generated evenbot app
** (Mix) Could not start application evenbot: Evenbot.Application.start(:normal, []) returned an error: shutdown: failed to start child: Evenbot.Bot
    ** (EXIT) an exception was raised:
        ** (ArgumentError) errors were found at the given arguments:

  * 1st argument: the table identifier does not refer to an existing ETS table
...

It was running fine, via mix run --no-halt , until I tried to add :logger_file_backend for locally storing the logs.

my mix.exs

defmodule Evenbot.MixProject do
  use Mix.Project

  def project do
    [
      app: :evenbot,
      version: "0.1.0",
      elixir: "~> 1.13",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      applications: [:logger_file_backend, :logger],
      extra_applications: [:logger],
      mod: {Evenbot.Application, []}
    ]
  end
defp deps do
    [

      {:ex_gram, "~> 0.26"},
      {:tesla, "~> 1.4"},
      {:hackney, "~> 1.12"},
      {:jason, ">= 1.3.0"},
      {:logger_file_backend, "~> 0.0.10"}

    ]
  end
end

config.exs

import Config

config :logger,
  backends: [{LoggerFileBackend, :debug_log}]

config :logger, :debug_log,
  path: 'myLog.log',
  level: :debug

I don’t understand what the error message is trying to say.

1 Like

strangely enough, above works fine when config.exs is

import Config

config :logger,
  backends: [
    {LoggerFileBackend, :error}
  ]

config :logger, :error,
  path: '/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/error.log',
  level: :error

but throws FunctionCLauseError when config.exs is

import Config

config :logger,
  backends: [
    {LoggerFileBackend, :info},
    {LoggerFileBackend, :error}
    
  ]

config :logger, :info,
  path: '/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/info.log',
  level: :info

  config :logger, :error,
  path: '/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/error.log',
  level: :error

also, Any Logger.info(date: date_from_function) are not being logged to appropriate file.

debug attempt 1 :

followed this

require Logger
user_name = "Julio"
Logger.info("Hey, it's me: #{user_name}")

expected output is :

11:29:55.379 [info]  Hey, it's me: Julio

my output is :

iex(4)> Logger.info("Hey, it's me: #{user_name}")
:ok

Why?

debug attempt 2:

:gen_event handler {LoggerFileBackend, :info} installed in Logger terminating
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in LoggerFileBackend.log_event/5
        (logger_file_backend 0.0.13) lib/logger_file_backend.ex:63: LoggerFileBackend.log_event(:info, ["GET", " ", "https://api.telegram.org/bot-yM/getUpdates", " -> ", "200", " (", '14294.646', " ms)"], {{2022, 3, 27}, {14, 42, 2, 920}}, [erl_level: :info, application: :tesla, domain: [:elixir], file: "lib/tesla/middleware/logger.ex", function: "call/3", gl: #PID<0.256.0>, line: 173, mfa: {Tesla.Middleware.Logger, :call, 3}, module: Tesla.Middleware.Logger, pid: #PID<0.295.0>, time: 1648372322920478], %{format: [:time, " ", :metadata, "[", :level, "] ", :message, "\n"], inode: nil, io_device: nil, level: :info, metadata: [], metadata_filter: nil, name: :info, path: '/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/info.log', rotate: nil})
        (stdlib 3.17) gen_event.erl:627: :gen_event.server_update/4
        (stdlib 3.17) gen_event.erl:609: :gen_event.server_notify/4
        (stdlib 3.17) gen_event.erl:351: :gen_event.handle_msg/6
        (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

It mentions io_device: nil I suspect that’s the error. Not sure though.

Issue resolved. Logger working now.

I had a typo path: '/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/info.log',
is a charlist , not string

it should have been
path: "/Users/abhishektripathi/Downloads/march2022/evenpdf_bot/info.log"