RAISE NOTICE and supabase logs
# sql
l
RAISE NOTICE and supabase logs
do "Raise notice" commands in functions appear in supabase db logs? Cant find them anywhere.
c
I don't think so - I think it only shows WARNING and up
not sure if there is a way to change this behavior
l
ah ok. Will try warnings instead... still searching for a nice way to debug things...
c
also, I could be wrong, but from one experiment I noticed that those logs are preserved only for a few hours and then they roll over (of course, that would depend on the volume of logs, but I noticed this with almost no app logs from my side)
l
yeah.. regarding preservation you are right
c
one alternative, which I implmented is to have a log table that I maintain myself and I write to it using a function I defined
the tricky part with this approach is to make sure the log gets written even if a transaction fails and rollsback
l
good idea with the log table... could be a way to go...
ups... yeah.. but no transactions on my side yet... so i am safe 🙂
c
you can achieve this by wrapping the insert call in a dblink_ call, as if you are calling a remote server
not sure what you mean by "no transactions on my side yet" 🙂 I think PostgreSQL enforces transactionality by default, it's just a question the isolation level
l
oh you mean everything is wrapped in a transaction? OK.. then its a thing. Just new to postgres and dont know too much about it yet. But 20 years of relational db experience should me get up to speed fast.
thanks for info.
c
no problem, but double-check what I say because I could be wrong OR we could be talking about different things.
Since you are talking about logs, I assume you want to log inside functions, and everything inside a functions is bundled in a transaction
l
yeah.. its about functions.. thanks for the link... i will experiment more on this...