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

plugin-bcli returning "\n" instead of line break in the logfile #4912

Open
guibressan opened this issue Nov 9, 2021 · 6 comments · May be fixed by #7013 or #7944
Open

plugin-bcli returning "\n" instead of line break in the logfile #4912

guibressan opened this issue Nov 9, 2021 · 6 comments · May be fixed by #7013 or #7944
Labels
good first issue good for onboarding logging

Comments

@guibressan
Copy link

guibressan commented Nov 9, 2021

v0.10.2

Steps to Reproduce

bitcoind process got killed with lightningd running

lightning logfile output

Screen Shot 2021-11-08 at 21 56 12

@ZmnSCPxj
Copy link
Contributor

ZmnSCPxj commented Nov 9, 2021

This occurs for all plugins. Is it really that much of a concern?

@vincenzopalazzo
Copy link
Contributor

This occurs for all plugins. Is it really that much of a concern?

Not important I think because the console should be formatted fine (?). However, maybe on the file, we can make some trick to split the string by "\n" token to make easy the human parsing of the file?

@ZmnSCPxj
Copy link
Contributor

ZmnSCPxj commented Nov 9, 2021

Seems a an easy thing to do, probably should hook somewhere in lightningd/log.c, so that all logging does this?

@ZmnSCPxj ZmnSCPxj added good first issue good for onboarding logging labels Nov 9, 2021
@guibressan
Copy link
Author

This occurs for all plugins. Is it really that much of a concern?

This is just a little inconvenient. I can understand the information perfectly.

@vincenzopalazzo
Copy link
Contributor

Seems a an easy thing to do, probably should hook somewhere in lightningd/log.c, so that all logging does this?

@ZmnSCPxj I can make some experiments later this week, and report there the result.

This is just a little inconvenient. I can understand the information perfectly.

BTW, we can try to improve this error message, thanks to report this

starius added a commit to starius/lightning that referenced this issue Jan 25, 2024
starius added a commit to starius/lightning that referenced this issue Jan 25, 2024
Double escape node alias in the log, to print weird node alias
in escaped form.

Fix ElementsProject#4912
@ecurrencyhodler
Copy link

Hello! @starius submitted PR #7013 for this issue which was posted as a bounty: https://community.sphinx.chat/bounty/1214

Would it be okay to assign him the issue and review his pr?

starius added a commit to starius/lightning that referenced this issue Feb 8, 2024
Previously, the code utilized JSON-encoded text to pass log messages to the
log_() function, resulting in new lines being printed to the log as '\n'. This
commit addresses this issue by unescaping and splitting the log message into
lines, with each non-empty line being logged separately.

It is deemed acceptable to pass non-printable characters to log_() since they
are replaced with "?" in the logv() function, invoked by log_(). Therefore,
leaving lines JSON unescaped is permissible.

It's important to note that only the last log_() call may have call_notifier
set to true. This adjustment is crucial to prevent Python tracebacks complaining
about a broken pipe after lightningd exits.

Fix ElementsProject#4912

For reference, the log of lightningd failing without a backend:

./lightningd/lightningd
2024-02-08T20:33:17.642Z INFO    lightningd: v23.11-257-g968d6d6-modded

Could not connect to bitcoind using bitcoin-cli. Is bitcoind running?

Make sure you have bitcoind running and that bitcoin-cli is able to connect to bitcoind.

You can verify that your Bitcoin Core installation is ready for use by running:

    $ bitcoin-cli echo 'hello world'
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: Could not connect to bitcoind using bitcoin-cli. Is bitcoind running?
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: Make sure you have bitcoind running and that bitcoin-cli is able to connect to bitcoind.
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: You can verify that your Bitcoin Core installation is ready for use by running:
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli:     $ bitcoin-cli echo 'hello world'
2024-02-08T20:33:18.227Z INFO    plugin-bcli: Killing plugin: exited before we sent init
The Bitcoin backend died.
starius added a commit to starius/lightning that referenced this issue Feb 8, 2024
Previously, the code utilized JSON-encoded text to pass log messages to the
log_() function, resulting in new lines being printed to the log as '\n'. This
commit addresses this issue by unescaping and splitting the log message into
lines, with each non-empty line being logged separately.

It is deemed acceptable to pass non-printable characters to log_() since they
are replaced with "?" in the logv() function, invoked by log_(). Therefore,
leaving lines JSON unescaped is permissible.

It's important to note that only the last log_() call may have call_notifier
set to true. This adjustment is crucial to prevent Python tracebacks complaining
about a broken pipe after lightningd exits.

Fix ElementsProject#4912

For reference, the log of lightningd failing without a backend:

./lightningd/lightningd
2024-02-08T20:33:17.642Z INFO    lightningd: v23.11-257-g968d6d6-modded

Could not connect to bitcoind using bitcoin-cli. Is bitcoind running?

Make sure you have bitcoind running and that bitcoin-cli is able to connect to bitcoind.

You can verify that your Bitcoin Core installation is ready for use by running:

    $ bitcoin-cli echo 'hello world'
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: Could not connect to bitcoind using bitcoin-cli. Is bitcoind running?
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: Make sure you have bitcoind running and that bitcoin-cli is able to connect to bitcoind.
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli: You can verify that your Bitcoin Core installation is ready for use by running:
2024-02-08T20:33:18.227Z **BROKEN** plugin-bcli:     $ bitcoin-cli echo 'hello world'
2024-02-08T20:33:18.227Z INFO    plugin-bcli: Killing plugin: exited before we sent init
The Bitcoin backend died.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue good for onboarding logging
Projects
None yet
4 participants