Hi guys, i've been searching for a solution but i ...
# orm-help
j
Hi guys, i've been searching for a solution but i cant get logs to work in prisma client, i wanted to see the sql that was generated, can someone help me? yhx
r
j
Yes i've done all of that, the I also ried a package prisma-query-log... Im using fastify as the server... I dont know whats happening 😞
m
Did you try
logger: true
? Logging in fastify is disabled by default: https://www.fastify.io/docs/latest/Logging/
j
yes, but only logs fastify stuff
{"level":30,"time":1636385498499,"pid":15564,"hostname":"Joao-Pc","reqId":"req-f","res":{"statusCode":304},"responseTime":1.448599997907877,"msg":"request completed"}
m
I have just tested and it works for me. Can you show me the the code where you set up prisma logging? This part for query should be
Copy code
{
      emit: 'stdout',
      level: 'query',
    },
Don't use the event based logging, just copy the part from '*Log to stdout*': https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/logging#log-to-stdout
remember that the emit should be 'stdout' not 'event'
Oh I see now, you've posted it already. Hmm it works for me and the
logger: true
doesnt even have to be set.
j
Imgoping to try that again...
No it doesnt work... I must be doing something wrong... whta the hell
@Maciek K sorry, it was my fault, iniside the resolvers i was using another newPrismaClient instead o using the context one... Im a moron, sorry guys for wasting your time, and thx
It works now
m
ok no probs 😂
❤️ 1