Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud code logs #2370

Merged
merged 2 commits into from
Jul 23, 2016
Merged

Cloud code logs #2370

merged 2 commits into from
Jul 23, 2016

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Jul 23, 2016

Fixes #2244

  • Adds info log when running triggers and functions
  • Adds error logs when trigger or function fails
  • Match original parse.com log implementation

@codecov-io
Copy link

codecov-io commented Jul 23, 2016

Current coverage is 91.81% (diff: 100%)

Merging #2370 into master will decrease coverage by <.01%

@@             master      #2370   diff @@
==========================================
  Files            95         95          
  Lines         10633      10670    +37   
  Methods        1295       1303     +8   
  Messages          0          0          
  Branches       1736       1738     +2   
==========================================
+ Hits           9764       9797    +33   
- Misses          869        873     +4   
  Partials          0          0          

Powered by Codecov. Last update 93b4117...646baa7

@flovilmart flovilmart added this to the 2.2.17 milestone Jul 23, 2016
@@ -94,7 +94,7 @@ function del(config, auth, className, objectId, clientSDK) {
// Returns a promise for a {response, status, location} object.
function create(config, auth, className, restObject, clientSDK) {
enforceRoleSecurity('create', className, auth);
var write = new RestWrite(config, auth, className, null, restObject, clientSDK);
var write = new RestWrite(config, auth, className, null, restObject, null, clientSDK);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started having SDK and version set on those objects :/

@tanmays
Copy link

tanmays commented Jul 26, 2016

@flovilmart just tried the latest 2.2.17 release, how do I configure it to show just the messages from console.log statements? Right now its showing the entire request-response even with verbose off. Even if I explicitly set verbose to false it still logs in verbose.

@drew-gross drew-gross deleted the cloud-code-logs branch July 26, 2016 07:53
@TylerBrock
Copy link
Contributor

TylerBrock commented Jul 27, 2016

@tanmays thanks for reporting this, I noticed the same thing and unfortunately you can't turn them off currently. This is so the cloud code logs work in the dashboard, it's only showing the requests and responses of the cloud code functions and not every request to parse-server.

In the future hopefully we will try to work the code so that the logs for the cloud code needed for the dashboard aren't also logged to the console unless in verbose mode.

@tanmays
Copy link

tanmays commented Jul 27, 2016

@TylerBrock thanks! Hopefully we can achieve the same behaviour as Parse.com dash where only console statements are logged and not req/res (unless verbose is on). Right now 99% of my code is via cloud code and my console log is barely readable. :(

@Siedrix
Copy link

Siedrix commented Aug 3, 2016

@tanmays Im having the same problem, code changes on FunctionsRouter.js now make the console unreadable, both on dev and on production.

I would suggest a way to set winston log level in the server config.

For now, do:

var winston = require('winston');
winston.level = 'warn';

If you add this code before the new ParseServer({conf}), you prevent all this logging.

@joeyslack
Copy link

joeyslack commented Aug 24, 2016

@Siedrix You saved my life! I was hacking around in the logging adapters, and found this fix to be much much better.

Since 2.2.18 release is completely broken, being able to fix the logging on 2.2.17 has saved me an enormous amount of money in logging costs (hosted logging).

Edit: Unfortunately, it fixes items manually logged with winston, but not normal app logs.

@flovilmart
Copy link
Contributor Author

You should be able to set the logLevel on Parse server initialisation with 2.2.18.

When you say completely broken, can you open more issues so we can cook 2.2.19 ASAP

@joeyslack
Copy link

joeyslack commented Aug 24, 2016

Hey there,

Along with: 
#2570
, header issues, dashboard integration issues, https and piggyback ssl issues, “parse-server” cannot be found, I’m not even sure if we have anyone testing 2.2.18? On a fresh install, I simply cannot get it to work in a dev environment. Perhaps I’m doing something wrong, but I guess I don’t see what everyone else does. parse-server just refuses to be loaded, cannot be found in path.

BTW, I'm not hating on the hard work everyone has been doing! Good job everyone. Just a matter of fact for me :)

@flovilmart
Copy link
Contributor Author

@joeyslack the more contributions, the faster it will be solved :)

@sprabs
Copy link

sprabs commented Aug 31, 2016

Sorry if this is the wrong place to post...

I'm guessing this has to be something with my setup, but I can no longer see logs other than those from the parse-server-push-adapter, new objects created, and console.log statements explicitly in the Cloud Code. I really want to see errors and info, but even verbose on, it's not working:

verb parse-server-push-adapter GCM "message_id": "0:1472668642692974%a8fa1296f9fd7ecd"
verb parse-server-push-adapter GCM },
verb parse-server-push-adapter GCM {
verb parse-server-push-adapter GCM "message_id": "0:1472668642694754%a8fa1296f9fd7ecd"
verb parse-server-push-adapter GCM },
verb parse-server-push-adapter GCM {
verb parse-server-push-adapter GCM "message_id": "0:1472668642692145%a8fa1296f9fd7ecd"
verb parse-server-push-adapter GCM }
verb parse-server-push-adapter GCM ]
verb parse-server-push-adapter GCM }
ParseObjectSubclass { className: 'Contacts', _objCount: 1162, id: '0WFUr5CWQV' }

It was fine until I did a pull on master in the last week. I noticed there have been quite a few PRs for logging recently. With these changes are there any additional things we need to add to see the logs? I currently have this line in index.js:

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

and inside the new ParseServer block:
loggerAdapter: new logger({ logsFolder: './' })

I'm running my app on AWS Elastic Beanstalk.

rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 15, 2017
* Adds logging (info/error) when running cloudCode triggers

* Adds logs for cloud-function calls

- Match parse.com original logging
rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 16, 2017
* Adds logging (info/error) when running cloudCode triggers

* Adds logs for cloud-function calls

- Match parse.com original logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants