parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

How to enable parse-server logs ?

Open ghost opened this issue 10 years ago • 13 comments

As described in the tutorial to send push notifications, I am trying to log the status of my notifications sent to my parse-server. In this tutorial, it is written :

If your Parse Server logs, you can see something similar to ...

Until now, here is my configuration :

var api = new ParseServer({
    databaseURI: 'mongodb://user:password@url:1111/App',
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: 'XXX',
    masterKey: 'XXX',
    clientKey: 'XXX',
    restAPIKey: 'XXX',
    push: {
        ios: {
            pfx: 'certificat/Certificats.p12',
            bundleId: 'com.xxx.xxx',
            production: false
        }
    }
});

How to enable logs on my Parse Server to get the status of my notifications ?

Thanks!

ghost avatar Feb 24 '16 12:02 ghost

Have you tried enabling verbose using export VERBOSE=1 before launching your server ?

thibauddavid avatar Feb 24 '16 14:02 thibauddavid

I think their is a /log endpoint you can call, I cant seem to find the docs on it right now though..

gateway avatar Feb 24 '16 17:02 gateway

We have a LoggerAdapter and a /logs endpoint however specific to your question on the Push documentation, the logs are going through the console interface. cc: @wangmengyan95 to confirm.

peterdotjs avatar Feb 24 '16 19:02 peterdotjs

We don't track yet the status for push notifications, see #566.

flovilmart avatar Feb 24 '16 19:02 flovilmart

Thanks for your answers guys!

@flovilmart then why is it written :

If your Parse Server logs, you can see something similar to ...

On this page ?

ghost avatar Feb 25 '16 08:02 ghost

It may spew some logs as push is being handled, but it's not storing the push status in the database is what he means. Going to close this one, if there are any outstanding issues, please open a new issue. Thanks.

gfosco avatar Feb 26 '16 11:02 gfosco

This issue is closed but ranks highly in Google and doesn't actually explain how to see logs in a parse-server environment. Can you please add a link or example?

charliewilliams avatar Mar 02 '16 15:03 charliewilliams

I second the motion - "This issue is closed but ranks highly in Google and doesn't actually explain how to see logs in a parse-server environment. Can you please add a link or example?"

zurcjoe avatar Mar 02 '16 17:03 zurcjoe

In Heroku you can set a config var "VERBOSE" to true. In index.js you should also be able to set: process.env.VERBOSE=true;

rsweny avatar Mar 16 '16 17:03 rsweny

can anyone go into this with a little greater depth? I am currently trying to access the parse server logs. I am using Heroku and mLabs. I have gone into Heroku and set a new config var "VERBOSE" to "true". My git server does not have a folder named logs and i cannot for the life of me find out where these logs would be. Thank you in advance.

Is my setting of the config vars done correctly?

If so, where are these logs located and how can i access them?

Jerland2 avatar Apr 15 '16 04:04 Jerland2

On the Heroku Dashboard, on the top right of the main screen for your app there should be an icon with 3 vertical dots. Under there should be a view logs menu item. Lately it seems my logs are always VERBOSE though regardless of what I set.

rsweny avatar Apr 15 '16 12:04 rsweny

OK, for those coming here via Google search looking for logging.

I had used the line from @rsweny process.env.VERBOSE=true; above and that did enable verbose logging. Later I changed this value to false but couldn't understand why it was still logging at verbose levels.

I just figured out that if you set the environment variable 'VERBOSE' to anything it will log everything. I commented out that line so that variable is undefined and I'm back down to minimal logging + whatever I log to the console from cloud code.

Hope that helps, I think figuring out logging using their adapter and then figuring how to effectively monitor my app in AWS will be next on my list to do.

EDIT: lol, just found that this effectively sets log level to 'silly' in ParseServer.js:

    if (verbose || process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER) {
      configureLogger({level: 'silly'});
    }

A better approach then would be to explicitly set verbosity in the ParseServer init:

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  verbose: false,
...

chadpav avatar Apr 27 '16 19:04 chadpav

@rsweny 's answer helped!

Since Heroku's UI changed, I'll add quick walkthrough:

  1. Go to Settings tab, click Reveal Config Vars and add VERBOSE=true variable
  2. In the top right corner of the screen there is "Open app" button and next to it "More". Click "More" and choose "View logs".

duhovny avatar Oct 27 '16 03:10 duhovny