-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Logs missing timestamp #5560
Comments
There is an issue in the PHP SDK as well. A PR would be great. You can start with the guide for contributing https://github.com/parse-community/parse-server/blob/master/CONTRIBUTING.md |
+1 |
another issue I notice is with the latest version, the logs are all |
Looks like @acinader has got it covered... 😃 There are a few examples of how to combine formats to get a similar output 2.*, take a look at this file: https://github.com/winstonjs/winston/blob/master/examples/quick-start.js Maybe this type of formater is ok? format.combine(
format.timestamp(),
format.errors({ stack: true }),
format.splat(),
format.json()
) Personally I have been using a custom adapter for a while now, see below: const winston = require('winston');
const env = require('./env');
const { format } = winston;
const {
combine, timestamp, printf,
} = format;
const print = printf(info => `${info.timestamp} - ${info.level}: ${info.message}`);
const transports = [
new winston.transports.Console({
level: env.environment === 'localhost' ? 'info' : 'warn',
}),
new winston.transports.File({
filename: `${env.logFilePath}/parse-server.log`,
level: 'warn',
}),
];
const logger = winston.createLogger({
format: combine(
timestamp(),
print,
),
transports,
});
module.exports = logger; |
Issue Description
Logs for info and error do not have a timestamp, which causes an issue with Parse-Dashboard to not be able to view any logs, because it will break the UI. Since Winston Logger was upgraded to 3.x, timestamp format has been changed.
Steps to reproduce
In a Parse Cloud function, running
request.log.info("foo")
or
request.log.error("bar")
Expected Results
in parse-server/logs
in
parse-server.info.DATE-OF-LOG
expect to see
{ "level": "info", "message": "foo", timestamp: "TIME-OF-LOG" }
also in
parse-server.error.DATE-OF-LOG
expect to see
{ "level": "error", "message": "bar", timestamp: "TIME-OF-LOG" }
Actual Outcome
in parse-server/logs
in
parse-server.info.DATE-OF-LOG
expect to see
{ "level": "info", "message": "foo" }
also in
parse-server.error.DATE-OF-LOG
expect to see
{ "level": "error", "message": "bar" }
Environment Setup
I have created a fix, but I am not sure how to submit the Pull Request to push my changes, which are VERY minor :)
The text was updated successfully, but these errors were encountered: