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

prefix log lines with spin and component-id #1116

Open
michelleN opened this issue Feb 7, 2023 · 6 comments
Open

prefix log lines with spin and component-id #1116

michelleN opened this issue Feb 7, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@michelleN
Copy link
Collaborator

michelleN commented Feb 7, 2023

It's hard to tell which log lines output comes from Spin vs from the actual application (a component). It'd be nice to prefix log lines output with this information: [Spin] and [Component-ID]

For example, if we were to the run the example http rust app which has a single component called hello, the logs looks like this:

Serving http://127.0.0.1:3000
Available Routes:
  hello: http://127.0.0.1:3000 (wildcard)
{"host": "127.0.0.1:3000", "connection": "keep-alive", ... "spin-path-info": "/", "spin-full-url": "http://127.0.0.1:3000/", "spin-matched-route": "/...", "spin-base-path": "/", "spin-raw-component-route": "/...", "spin-component-route": ""}

With the component-id and spin prefixes, the logs output would look like this.

$ spin up
[Spin] Serving http://127.0.0.1:3000
[Spin] Available Routes:
  hello: http://127.0.0.1:3000 (wildcard)
[hello] {"host": "127.0.0.1:3000", "connection": "keep-alive", ... "spin-path-info": "/", "spin-full-url": "http://127.0.0.1:3000/", "spin-matched-route": "/...", "spin-base-path": "/", "spin-raw-component-route": "/...", "spin-component-route": ""}

Would appreciate any feedback here.

@michelleN michelleN changed the title prefix log lines with component ID prefix log lines with spin and component-id Feb 7, 2023
@michelleN michelleN added enhancement New feature or request open for comment labels Feb 7, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Triage Needed in Spin Triage Feb 7, 2023
@michelleN michelleN moved this from 🆕 Triage Needed to 📋 Investigating / Open for Comment in Spin Triage Feb 7, 2023
@itowlson
Copy link
Collaborator

itowlson commented Feb 7, 2023

Apologies for the pedantry but... the specific Spin output lines you quote are not logs - they are written directly as actionable information for the user. They should not receive logging-style decoration and their layout should be preserved (or at least modified only consciously).

Obviously this does not affect the broader issue - it relates purely to the example.

@itowlson
Copy link
Collaborator

itowlson commented Feb 7, 2023

FWIW Spin logs appear like this, at least on Linux:

image

The top stanza is logs (only errors by default). Then the startup message, and then the application log. I agree for sure that the startup message runs into the application log rather!

@michelleN
Copy link
Collaborator Author

the specific Spin output lines you quote are not logs - they are written directly as actionable information for the user.

good point. I updated the description to be more clear.

@itowlson
Copy link
Collaborator

itowlson commented Feb 7, 2023

I'm not in favour of decorating normal user interaction this way. If we're going to decorate stuff, it should be the stuff you only use for diagnostics when something's gone wrong, not the stuff you see as part of normal operation and that is intended to be interacted with.

@lann
Copy link
Collaborator

lann commented Mar 3, 2023

Related discussion on Discord: https://discord.com/channels/926888690310053918/1081227946976616528/1081234846430535721

I have several components + a "common/utils" crate where I have some functions used in my different components. When there is a failure in one of these functions, I log an error. My problem is that I don't know which component caused the error.

@radu-matei
Copy link
Member

+1 on additional information on which component a log line originated from.

@melissaklein24 melissaklein24 added this to the 1.6.0 milestone Sep 13, 2023
@michelleN michelleN moved this from 📋 Investigating / Open for Comment to 🔖 Backlog in Spin Triage Sep 25, 2023
@michelleN michelleN self-assigned this Sep 26, 2023
@michelleN michelleN moved this from 🔖 Backlog to 🏗 In progress in Spin Triage Sep 26, 2023
michelleN added a commit to michelleN/spin that referenced this issue Oct 10, 2023
resolves spinframework#1116

Signed-off-by: Michelle Dhanani <michelle@fermyon.com>
Co-authored-by: Brian Hardock <brian.hardock@fermyon.com>
michelleN added a commit to michelleN/spin that referenced this issue Oct 11, 2023
resolves spinframework#1116

Signed-off-by: Michelle Dhanani <michelle@fermyon.com>
@melissaklein24 melissaklein24 removed this from the 1.6.0 milestone Feb 13, 2024
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

5 participants