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

Log objects rather than JSON strings and option for single line logs #2028

Merged
merged 3 commits into from
Jul 15, 2016

Conversation

spenthil
Copy link
Contributor

No description provided.

@spenthil
Copy link
Contributor Author

spenthil commented Jun 10, 2016

EDIT: Went a different direction - see #2028 (comment) for updated description.

VERBOSE=1 parse-server --appId YOUR_APP_ID --masterKey YOUR_MASTER_KEY

VERBOSE=1 SHORT_LOGS=1 parse-server --appId YOUR_APP_ID --masterKey YOUR_MASTER_KEY

* to the console
* daily rotating files as new line delimited JSON

Logs are also be viewable in Parse Dashboard but it only displays the `messages` field of each log entry. For example, with VERBOSE set this will exclude `origin` on each request.
Copy link
Contributor

Choose a reason for hiding this comment

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

This paragraph is probably unnecessary. Could be shortened to "Logs are also viewable in Parse Dashboard."

@TylerBrock
Copy link
Contributor

bump on this one, would be nice to have the logs working on cloudwatch if you have some free cycles @spenthil

@flovilmart
Copy link
Contributor

Also on GCP, one line JSON's would be nice to read :)

@flovilmart
Copy link
Contributor

https://cloud.google.com/appengine/articles/logging#filtering_and_finding_logs

The recommendations for JSON logging on app engine

@ghost
Copy link

ghost commented Jul 8, 2016

@spenthil updated the pull request.

@@ -184,6 +184,10 @@ export default {
env: "VERBOSE",
help: "Set the logging to verbose"
},
"jsonLogs": {
env: "JSON_LOGS",
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to PARSE_SERVER_JSON_LOGS

@ghost
Copy link

ghost commented Jul 8, 2016

@spenthil updated the pull request.

@spenthil
Copy link
Contributor Author

spenthil commented Jul 8, 2016

Instead of the shortLogs flag - I added jsonLogs. When enabled, console output is the JSON object as a single line, rather than just the message attribute as multi line. Parse dashboard will still output the message attribute as multiline. This requires no mucking around with the logging object to get structured logs in AWS CloudWatch, Google Cloud Logging, etc.


@@ -75,5 +90,5 @@ export function addGroup(groupName) {
return winston.loggers.get(groupName);
}

export { logger };
export {logger};
Copy link
Contributor

Choose a reason for hiding this comment

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

revert that line please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@flovilmart
Copy link
Contributor

Got a few comments, I'll try it out later to see how it looks like

@ghost
Copy link

ghost commented Jul 9, 2016

@spenthil updated the pull request.

@flovilmart
Copy link
Contributor

@drew-gross I think it's all good for that PR on my side, should we merge and move forward with it?

@@ -59,7 +59,7 @@ describe('verbose logs', () => {
level: 'verbose'
});
}).then((results) => {
expect(results[1].message.includes('"password": "********"')).toEqual(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer testing the thing it should be testing, which is that passwords don't get output to the logs. The original version of this PR caused passwords to start getting output to logs, so I'd like to see these tests either not change, or be a lot more high-level/E2E and test the actual string that is logged rather than some intermediate object.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would agree with that. That's majorly blocking

@drew-gross
Copy link
Contributor

I'm a bit concerned about those tests. But as long as the dashboard still shows logs without any effort, I'll leave it up to you.

@ghost
Copy link

ghost commented Jul 15, 2016

@spenthil updated the pull request.

@spenthil
Copy link
Contributor Author

@flovilmart added spenthil@bc09f88 - looks like we are good to go now.

@drew-gross
Copy link
Contributor

Awesome, that looks great.

@flovilmart
Copy link
Contributor

Good! Let's go with that after Travis

@flovilmart flovilmart merged commit 7d234e0 into parse-community:master Jul 15, 2016
@flovilmart
Copy link
Contributor

Great Job @spenthil !

@spenthil
Copy link
Contributor Author

no thank YOU @flovilmart & @drew-gross

rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 15, 2017
…arse-community#2028)

* Log objects rather than JSON strings and option for single line logs

This reverts commit fcd914b.

* Better password stripping tests
rsouzas pushed a commit to back4app/parse-server that referenced this pull request Mar 16, 2017
…arse-community#2028)

* Log objects rather than JSON strings and option for single line logs

This reverts commit fcd914b.

* Better password stripping tests
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.

5 participants