Logs Shown as Error (Celery, Beat, FastAPI)
fehmisener
FREEOP

5 months ago

Hello lads,

As you can see from the image below, my celery beat or FastAPI worker logs appear as error logs. I'm not sure if this is a common thing or just me having this kind of problem.

This is my logging.py implementation

Solved$10 Bounty

4 Replies

Railway
BOT

5 months ago

Our team is working on getting back to you as soon as possible. In the meantime, we've found the following might help you get unlocked faster:

If you find the answer from one of these, please let us know by solving the thread! Otherwise, we’ll be in touch.


idiegea21
HOBBY

5 months ago

Hi man,

To fix this issue of Railway marking your Celery or FastAPI logs as "errors" despite being at the INFO level, ensure all logs are explicitly routed to stdout (not stderr) by using StreamHandler(sys.stdout) and apply your logging setup in Celery using the @setup_logging.connect signal. Simplify your log format to clearly include the log level early (e.g., "%(levelname)s: %(message)s") and avoid logging complex structures like tuples or dictionaries that could confuse Railway's log parser. These changes help prevent misclassification of benign logs as errors in the Railway UI.


idiegea21

Hi man,To fix this issue of Railway marking your Celery or FastAPI logs as "errors" despite being at the INFO level, ensure all logs are explicitly routed to stdout (not stderr) by using StreamHandler(sys.stdout) and apply your logging setup in Celery using the @setup_logging.connect signal. Simplify your log format to clearly include the log level early (e.g., "%(levelname)s: %(message)s") and avoid logging complex structures like tuples or dictionaries that could confuse Railway's log parser. These changes help prevent misclassification of benign logs as errors in the Railway UI.

fehmisener
FREEOP

5 months ago

I'll try, thanks a lot


Status changed to Solved brody 5 months ago


idiegea21

Hi man,To fix this issue of Railway marking your Celery or FastAPI logs as "errors" despite being at the INFO level, ensure all logs are explicitly routed to stdout (not stderr) by using StreamHandler(sys.stdout) and apply your logging setup in Celery using the @setup_logging.connect signal. Simplify your log format to clearly include the log level early (e.g., "%(levelname)s: %(message)s") and avoid logging complex structures like tuples or dictionaries that could confuse Railway's log parser. These changes help prevent misclassification of benign logs as errors in the Railway UI.

brody
EMPLOYEE

5 months ago

For future reference, our logging system does not take into account the level printed in plaintext.

The only way we parse the level is from stdout/stderr or if you do JSON logging with a level attribute, and if you are logging JSON then there is nothing you could log that could confuse the JSON parser as long as it's valid JSON.


Status changed to Awaiting User Response Railway 5 months ago


Railway
BOT

4 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 4 months ago


Loading...