You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a FastAPI web service. Running with the FastAPI command doesn't work, because it doesn't seem to support HTTPS at all, so I am running my FastAPI app with a uvicorn command:
This works great, and even prints a very nice access log with color-coding that makes it very easy to read (though the lack of timestamps is unfortunate):
However, when I create a SystemD unit file and run the exact same command with SystemD, I get logs like this:
Now there's timestamps! But the colors are gone, it's not as easy to read.
While looking into this issue I tried logging into my PC over SSH and running the same command at the terminal, and got a third format:
When the exact same command is run in an SSH terminal instead of in-person, most of the color coding is preserved but some is lost. Weird.
While debugging that, I tried redirecting the logs to a text file to compare them with a hex editor...but this didn't work at all! When run this way, the color coding disappears completely, along with some of the log lines:
Why are there so many different log formats? Is there a way to get the same log when running under SystemD and also running at the terminal for testing? Preferably, I'd like logs with colors and timestamps whenever I run it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to write a FastAPI web service. Running with the FastAPI command doesn't work, because it doesn't seem to support HTTPS at all, so I am running my FastAPI app with a uvicorn command:
This works great, and even prints a very nice access log with color-coding that makes it very easy to read (though the lack of timestamps is unfortunate):
However, when I create a SystemD unit file and run the exact same command with SystemD, I get logs like this:
Now there's timestamps! But the colors are gone, it's not as easy to read.
While looking into this issue I tried logging into my PC over SSH and running the same command at the terminal, and got a third format:
When the exact same command is run in an SSH terminal instead of in-person, most of the color coding is preserved but some is lost. Weird.
While debugging that, I tried redirecting the logs to a text file to compare them with a hex editor...but this didn't work at all! When run this way, the color coding disappears completely, along with some of the log lines:
Why are there so many different log formats? Is there a way to get the same log when running under SystemD and also running at the terminal for testing? Preferably, I'd like logs with colors and timestamps whenever I run it.
Beta Was this translation helpful? Give feedback.
All reactions