fedimint icon indicating copy to clipboard operation
fedimint copied to clipboard

Logging tracking issue

Open justinmoon opened this issue 1 year ago • 4 comments

See this comment

For starters, let's reduce logs levels in code paths exercised by the CLI so that it is less noisy.

justinmoon avatar Oct 06 '22 23:10 justinmoon

I agree with @dpc's rules of thumb for the logging levels. Personally, I only want to see the cli-output/cli-error and no log lines in my terminal and much rather open another tmux pane/terminal and do tail -f <logfile> to follow the log.

For example

$ fedimint-cli reissue AQAAAAAAA...
2022-10-08T13:02:58.337688Z  INFO request{peer=0}: mint_client::api: web socket not connected, reconnecting
2022-10-08T13:02:58.337874Z  INFO request{peer=1}: mint_client::api: web socket not connected, reconnecting
2022-10-08T13:02:58.337940Z  INFO request{peer=2}: mint_client::api: web socket not connected, reconnecting
2022-10-08T13:02:58.338008Z  INFO request{peer=3}: mint_client::api: web socket not connected, reconnecting
2022-10-08T13:02:58.338341Z  INFO request{peer=0}: jsonrpsee_client_transport::ws: Connection established to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:4021", _mode: Plain, path_and_query: "/" }
2022-10-08T13:02:58.338430Z  INFO request{peer=2}: jsonrpsee_client_transport::ws: Connection established to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:4001", _mode: Plain, path_and_query: "/" }
2022-10-08T13:02:58.338474Z  INFO request{peer=1}: jsonrpsee_client_transport::ws: Connection established to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:4031", _mode: Plain, path_and_query: "/" }
2022-10-08T13:02:58.338496Z  INFO request{peer=3}: jsonrpsee_client_transport::ws: Connection established to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:4011", _mode: Plain, path_and_query: "/" }
2022-10-08T13:02:58.406067Z  WARN jsonrpsee_core::client::async_client: Custom("[backend]: frontend dropped; terminate client")
2022-10-08T13:02:58.406179Z  WARN jsonrpsee_core::client::async_client: Custom("[backend]: frontend dropped; terminate client")
2022-10-08T13:02:58.406243Z  WARN jsonrpsee_core::client::async_client: Custom("[backend]: frontend dropped; terminate client")
2022-10-08T13:02:58.406298Z  WARN jsonrpsee_core::client::async_client: Custom("[backend]: frontend dropped; terminate client")
{
  "id": {
    "txid": "f66a10f716d91368c045535a53e1fe8c7e39f36d468aca189fbfe7b6670d627f",
    "out_idx": 0
  }
}

While we could reduce the log level to debug for mint_client::api, the logs of jsonrpsee would still show up, which originate in the library (correct?).

Assuming that's correct, I would argue for (1) logging everything a logfile and only showing the cli-ouput and cli-error, which also contains an error message. Alternatively, (2) only logging warnings/errors to the command line with a multi sink setup as dpc already suggested in his comment.

I definitely agree on using info as default log level. Regarding the specific log message that the web socket is not connected, I'd probably keep it at level info (but I think you can judge that better), though, I don't want to see it while using the cli, imho.

What do you think?

Maaxxs avatar Oct 08 '22 13:10 Maaxxs

A log file would be rather uncommon for a client/one-shot CLI tool imo.

While we could reduce the log level to debug for mint_client::api, the logs of jsonrpsee would still show up, which originate in the library (correct?).

We can set different log level for different modules/crates by default so that during normal operation nothing is logged. We should also log to stderr instead of stdout imo so it never messes with the JSON output. This would also allow redirecting stderr to a log file in cases where this is wanted (e.g. when running with RUST_LOG=debug for debugging).

A good default log level might be error,mint_client=info,fedimint_cli=info after we fix our log levels internally.

elsirion avatar Oct 08 '22 15:10 elsirion

ah yes, that would be unusual for a one-shot cli tool. ok, sounds good :+1:

Maaxxs avatar Oct 09 '22 09:10 Maaxxs

FYI, the next jsonrpsee release will downgrade those logs to debug.

niklasad1 avatar Oct 12 '22 17:10 niklasad1