danielyogel
danielyogel•3d ago

Logger

Is it advised to use a logging library (Pino or similar) inside a Convex backend? Thanks! 🙏 Any reason not to do so? I understand some logs are created automatically by Convex.
8 Replies
Convex Bot
Convex Bot•3d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Clever Tagline
Clever Tagline•3d ago
Yes, Convex stores certain log data, which can be viewed via the dashboard. All console log lines are kept, along with extra lines about the success/failure of functions and other system notices/warnings. Logs are kept for each function execution, so if you open the Functions part of the dashboard and select a particular function, you can see (among other things) the logs for that specific function. In the main log area of the dashboard, all logs are displayed chronologically across all functions, though if you click on the 4-character truncated execution ID on any log line, all logs for that same function execution will display together. For some use cases, this is sufficient, but some people might want to do more with the log data, or view it in a different way, so Convex provides ways to send its logs to other services. I'm not familiar with logging libraries and the benefits that those provide. I don't see why you couldn't go that route, but it may duplicate some of Convex's own log behavior, so it's worth testing before going too deep with it. On a side note, I noticed that you posted this same question to the #general channel about an hour prior to posting here. It's best to just post a question once and wait a bit for someone to reply. Double-posting starts to feel like spam.
danielyogel
danielyogelOP•3d ago
Thank you @Clever Tagline , I’ve posted in general as well, no comment yet It’s nice that convex logs automatically, but it can not possibly log everything needed So manual logging is still valuable, and I don’t see any documentation about it.
erquhart
erquhart•3d ago
Pino should work fine, just requires Node. You'll probably want to use it with something like Axiom if you want logs for anything other than realtime troubleshooting.
danielyogel
danielyogelOP•3d ago
Thanks, but I don’t totally understand, do you mean I should use a third party service to scan the logs? What about the internal Convex dashboard? Related to Pino, I would prefer using Convex regular runtime, any other logger to use? Thanks!
Clever Tagline
Clever Tagline•3d ago
I think you missed my point. Posting here and also in another channel at the same time is not a good idea. It's best to just pick one so that a) it feels less like spam and b) the conversation doesn't get scattered.
danielyogel
danielyogelOP•3d ago
Sure thing, I will post only here, you can ignore the message in #general . This is not 100% clear to me. Thanks again ! If I understand correctly, it looks like convex does a lot of logging automatically, and maybe for extra manual logs - console log is enough? RequestID and extra info would be grouped automatically?
erquhart
erquhart•3d ago
Ah I see what you mean - yeah just console.log works great if you're logging and checking right away in the dashboard. If you click a log, the right panel opens with just the logs from that request so you have context I mentioned axiom because Convex logs don't stay around forever, but if this is just for dev and live-ish troubleshooting/debugging, yeah just use console.log

Did you find this page helpful?