Where is the server-side (API) console output or log?

As I’m trying to get the hang of RedwoodJs, I’m often wanting to use console.log even in the /api folder, but those statements obviously don’t appear in the browser console.

Within API functions, how can I output what a variable’s value is at the moment?

In particular, I’m trying to debug why I’m unable to persist to the DB a new record in a joiner table (explicit many-to-many relation).

Thanks.

E.g. https://github.com/ryancwalsh/principled_rw/blob/3f2781379fcaedd162dfe371c22505733c1a27e3/api/src/services/principles/principles.js#L58

The GraphQL API runs on port 8911. Have you tried the GraphQL Playground for your App?

http://localhost:8911/graphql/

This is coming from api/src/functions/graphql.js

If you were to create a new function, say api/src/functions/test.js, you could inspect it at http://localhost:8911/test/

Here’s a comment with an example.

Lastly, on the front-end you may find React Developer Tools browser extension very helpful.

Is this what you were looking for?

Thanks for your response. I hadn’t known what crabasa shared in that post, but that’s not what I was looking for.

I feel ridiculous: I eventually realized that the server-side console.log statements were outputting to my Git Bash terminal where I ran yarn rw dev. I don’t know how I didn’t notice them before. That’s what I was looking for. My question was probably too basic for you to know what I was asking. :wink:

And I finally bailed on explicit joiner tables (# 2 from First steps after tutorial), and it feels good to have at least the implicit version working.

I love seeing all of your posts… so positive and helpful!

1 Like

Wouldn’t it be amazing if they did show up in the browser’s console! Someone please write this up as a feature request! :slight_smile:

1 Like

As an issue at https://github.com/redwoodjs/redwood/issues/new or where?

Yes please! I can do it too, it’s a great idea and wouldn’t want to loose it!

1 Like

I was thinking the same thing! We can totally make that happen in dev mode (probably too dangerous to use in production).

1 Like

Added feature request: https://github.com/redwoodjs/redwood/issues/509

Thanks everyone.

P.S. I’m starting to get the redwoodjs tag on StackOverflow rolling with some questions (more to come soon): https://stackoverflow.com/questions/tagged/redwoodjs?sort=Newest&edited=true

@ryancwalsh it’s a pleasure! Thanks for taking notice and saying so :blush:

Also, your questions have helped add momentum to a topic I just posted (link below). Please add a comment if you have interest and/or suggestion about what would be helpful:

1 Like

I’ve just added this PR that’ll pull us in the right direction:

1 Like