-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Disable buffered logs #3892
Disable buffered logs #3892
Conversation
CLA
Hello there and welcome to our project! |
packages/twenty-server/src/main.ts
Outdated
@@ -16,7 +16,7 @@ import { EnvironmentService } from './integrations/environment/environment.servi | |||
const bootstrap = async () => { | |||
const app = await NestFactory.create(AppModule, { | |||
cors: true, | |||
bufferLogs: true, | |||
bufferLogs: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this change. @magrinj Is this useful to have buffered logs, if yes, maybe we should introduce an environment variable to leave to the user to choose what they prefers
@brody192 I've actually looked into this a bit more deeply and I am not sure to understand the problem. |
in my testing it just ends up looking like there are no logs coming through, even when ran for an hour, when logs are being buffered instead of immediately flushed. there are no lines for railway to scan so nothing gets sent to the deploy logs |
can you try again with the latest version of main? It should work, I don't think it is specific to Railways |
looks like log buffering is still enabled on the main branch, it's not going to work if logs aren't flushed on every log write, otherwise there are no logs for railways logging infrastructure to scan over, unless setting it to console mode disables buffering? I've tested twenty with and without log buffering enabled, logs only show when buffering is disabled. will try those variables! though, buffered logs are the number one reason we see users ask why they can't see their app's logs in railway. |
on railway they use a line scanner to parse each log line, but if logs are in a buffer that doesn't work, it only works when each log line is flushed individually, your local terminal has no issues showing you the log buffer. |
@brody192 Ok, could we add a LOGGER_IS_BUFFER_ENABLED env variable, default true, optional
|
I do not see any benefits to having log buffering enabled anyway. please share your reasoning for wanting it enabled (by default) |
@brody192 If you don't enable it, it seems that NestJS is not sending the startup logs through the logger I feel the default behavior should be that all logs go to the desired logger (if you setup a S3 logger, you also want the startup logs to go there) I think as long as it can be enabled through env vars, so it also works with railway scanner, everybody should be happy! |
@brody192 I'll go for this approach to unblock Railway users. Beside logs, did you manage to deploy Twenty on Railway? |
Sorry, I just saw this now! thank you for the detailed explanation, I was only thinking in the context of hosting the app on Railway or similar service, that all makes perfect sense now! the variables you provided do get the logs coming through, albeit all at once, but that's good enough for now!
and yes aside from the logs, I did manage to get it working wonderfully on Railway, they have a template concept that aims to offer near one-click deploys for sample apps and even as much as full-stack self-hostable apps like Twenty, here's the template I made https://railway.app/template/to7duB please check it out! |
This is great! |
self-hosting with my template would be as easy as clicking deploy now, saving the configs, filling out the SMTP stuff, and then clicking the final deploy button, wait a bit and you have a ready-to-use install of twenty! |
@brody192 that'd be amazing. I had tried to deploy to Railway but I didn't manage to do it because we rely on pg_graphql and they didn't support this Postgres extension / deployment of a custom Postgres through Docker. |
Railway supports docker images now and everything in the template deploys from a twenty docker image including the database! |
Oh great! |
I've now added |
Hosts like Railway use line scanners and thus when logs are buffered the result is that no logs show up.