Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress chain related logs #48

Closed
szg251 opened this issue Feb 28, 2022 · 5 comments
Closed

Suppress chain related logs #48

szg251 opened this issue Feb 28, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@szg251
Copy link
Collaborator

szg251 commented Feb 28, 2022

cardano-node and chain-index runs in a separate process and has access to stdout, printing out logs to the screen, polluting the test results. Ideally, we would use a verbose flag, or log levels to control this.

@szg251 szg251 added the enhancement New feature or request label Feb 28, 2022
@zmrocze
Copy link
Contributor

zmrocze commented Mar 25, 2022

This messy logging output consists of interleaved:

  1. cluster-logs, these are logged both to a file and to std outputs as seen here.

  2. cardano-node log from before logging is initialized. cardano-node/Run.hs

In 1) we probably simply want to remove LogToStdStreams from the list of logging outputs.

Log from 2) is a result of a putStrLn call that prints out a huge NodeConfiguration record. As long as the child process uses the same stdout as the test process, this will get printed. I haven't found yet the place where a new process for cardano-node is forked. If it is inside plutip code, then we could swap node's stdout for some other file handle.

Edit: new process is created deep down in cardano codebase (probably here directly)

@zmrocze
Copy link
Contributor

zmrocze commented Apr 2, 2022

Okey right, there is also chain-index as a third source of logging.

Let me show you what I did so far. I pr'ed a hack here where we:

  1. Remove stdout log output passed to cluster, so that the cluster now only logs to a log file.
  2. Wrap call to cardano-wallet's withCluster in a function that swaps out stdout file handle for provided handle to a file "node_configuration.log" in temp directory.

One can inspect "node_configuration.log" file by setting environment variable "NO_CLEANUP" to leave tmp dir unremoved.

Though with this fix the function withPlutusInterface is not thread-safe, it swaps stdout back and forth and other threads can observe various stdout handles. This happens already as the chain-index runs in second thread. It does some printing and sometimes it ends up in the "node_configuration.log" file. So 2. is indeed a hack.

As for the chain-index: Should I pr plutus-apps and add verbose flag to chain-index? This would remove the third source of unwanted logs. I've tried quickly running chain-index with forkProcess instead of async, but this ofc introduced some new problems.

@mikekeke
Copy link
Collaborator

IntersectMBO/plutus-apps#401 is merged, but updating chain-index will certainly break something.
There is discussion in progress atm about cardano-node and chain-index update strategy.

@mikekeke
Copy link
Collaborator

Should be fixed by #73

@mikekeke
Copy link
Collaborator

mikekeke commented Sep 2, 2022

Fixed by #73

@mikekeke mikekeke closed this as completed Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants