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

Not able to see Parse Logs in AWS Elastic Beanstalk

Open sprabs opened this issue 10 years ago • 11 comments

In my Parse app that is hosted on parse.com, there's an easy place to see the logs for Cloud Code (i.e, calls made, inputs, outputs). In my new test Parse app that is hosted on AWS Elastic Beanstalk, I am unable to see those same logs. I am able to tail logs in /var/log, but those do not send back Cloud Code errors. It only shows high-level nodejs errors and also log statements from code that is being executed.

Is there something we have to enable (I noticed there is a logs folder that's empty in /var/app/current) or do we have to setup those logs ourselves?

sprabs avatar Mar 03 '16 01:03 sprabs

I'm also not able to see the errors on the client side in the debugger. It's almost like the error is not being passed back?

sprabs avatar Mar 03 '16 01:03 sprabs

@sprabs you'll need to select the loggerAdapter and use info/error explicitly for logging. Wiki details, and test for an example. We currently only have a FileLogger adapter.

peterdotjs avatar Mar 03 '16 19:03 peterdotjs

can you show an example on how to setup the filelogger? im trying to use it with the parse serve example but without success

boardmain avatar Mar 04 '16 13:03 boardmain

Here's an example:

var logger = require('parse-server/lib/Adapters/Logger/FileLoggerAdapter').FileLoggerAdapter;

// ...

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337',  // Don't forget to change to https if needed
  loggerAdapter: new logger({ logsFolder: './' })
});

@peterdotjs do we / can we expose this adapter in an easier fashion?

gfosco avatar Mar 07 '16 08:03 gfosco

thank you, yes i found it, i was thinking the Adapter was exported by parse-server like the s3 adapter thank you

boardmain avatar Mar 07 '16 08:03 boardmain

Hi this example gives me error: loggerAdapter: new logger({ logsFolder: './' }), ^ TypeError: logger is not a function at Object. (/root/parse-server-example/index.js:27:18) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function.Module.runMain (module.js:447:10) at startup (node.js:148:18) at node.js:405:3

prodigy2m avatar Jun 14 '16 21:06 prodigy2m

@prodigy2m verify that you have this line as well: var logger = require('parse-server/lib/Adapters/Logger/FileLoggerAdapter').FileLoggerAdapter;

AnAppDev01 avatar Jul 09 '16 19:07 AnAppDev01

This is now referenced in the wiki page: https://github.com/ParsePlatform/parse-server/wiki/Configuring-LoggerAdapter

yairsz avatar Oct 15 '16 23:10 yairsz

FileLoggerAdapter is no longer part of parse-server and the link to configure LoggerAdapter on the wiki is broken. I couldn't find any up to date documentation for logging from cloud code, so I just npm installed winston and logged to my own file.

mer10z avatar Feb 16 '17 03:02 mer10z

@mer10z I'm deployed on beanstalks and I wrote an adapter to publish parse-server logs to AWS firehose which will aggregate logs from a cluster into a nice searchable gui.

https://www.npmjs.com/package/parse-aws-firehose-logger-adapter

if you want to use it and have any issues let me know...

acinader avatar Feb 16 '17 06:02 acinader

@acinader I'm having to bring up a new parse server in aws, I was looking how people where handling logs, I went to the link you posted and it says "This package is no longer maintained as I no longer use it for my project", are you still using this or is their another way to see streamed parse logs and save them to s3?

gateway avatar Apr 17 '18 22:04 gateway