Nothing written to the Log in Livebook

Hello All,
Running the below in livebook successfully but I do not see anything written to the log file as I want to confirm that the file system related executables was started successfully on windows :

Blockquote
Mix.install([
{:file_system, github: “falood/file_system” }
])

Then I defined a module “Watcher” using the library and initiated monitoring for a certain directory but no output in the log file.

Blockquote
{:ok, %{watcher_pid: pid}} = Watcher.init(dirs: [~S"D:\ABC"])

I checked the library code and it should write something to the log file whether for successful run of the program or in case of any failure. I ran it from command line and it was fine “the main executable emitting events”:

Blockquote
C:\Users\ghann\AppData\Local\mix\Cache\installs\elixir-1.17.1-erts-15.0\5a746b4645749932f02895cb44af6803\deps\file_system\priv>inotifywait.exe -r -m d:\ABC
===> Monitoring for All in d:\ABC -r for create, modify, delete, move
d:\ABC DELETE merchant_flow - Copy.gif

I’m unsure that lib add events to a log file.

I was reading their README, and I understood it sends the events as messages to a subscriber process:

Using their 1.0 version, it worked for me:

2 Likes

Thanks , I misunderstood part of the documentation.
But Is error the default level of logging for livebook? Do we have a way to update it ?
The below from my log file so I think “Error” is the default :

Blockquote
22:07:47.897 [error] ** (Bandit.HTTPError) Header read socket error: :closed
22:07:47.897 [error] ** (Bandit.HTTPError) Header read socket error: :closed
09:26:05.470 [error] ** (Bandit.HTTPError) Header read socket error: :closed

Also I am learning Elixir by trying to implement some ideas which we found a need for it, so in enterprises where you control release deployment to production you monitor certain servers and directories for a certain baseline , so assuming I want to do this using livebook do I have to deploy a livebook to each monitored server or device to communicate with the main one “dashboard or some slack plugin using livebook too”?

But Is error the default level of logging for livebook?

This applies only to the logs from the Livebook application itself, and the Livebook log file is also for those.

Logs emitted within the notebook and its dependencies should show up as part of cells output:

you monitor certain servers and directories for a certain baseline , so assuming I want to do this using livebook

Monitoring a directory inherently requires a process on the same server to do the monitoring, so if you want to monitor using Livebook, then Livebook needs to run on that server. The alternative would be to have some other process responsible for the monitoring that you start on each server, and write the events to some event queue database (which introduces extra complexity), then you use Livebook to consume these events. It all depends on the specifics.

3 Likes

Thanks , this turned out to be a good exercise to understand Elixir Gen Server too. Maybe this could be a good case of Pub/sub too as you need producers which are the clients in this case while the consumer will be the one to verify incoming message details against the ones loaded through release details or configuration screens. Having said that I noticed file_system is good for basic monitoring like file deleted/changed but nothing like checksum ,…etc.
But I still have a question for my info , can we change the default log level for livebook?

can we change the default log level for livebook?

You can set LIVEBOOK_DEBUG=1, this will show all application logs, such as requests and events.

1 Like