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

Feature/winston 3 migration #5275

Closed
wants to merge 11 commits into from
Closed

Feature/winston 3 migration #5275

wants to merge 11 commits into from

Conversation

pixel2
Copy link

@pixel2 pixel2 commented Jan 3, 2019

Migration to Winston 3.x. Had to make some major changes to the underlying structure since Winston 3 allows for multiple transports of the same type and does not track the transport name anymore.

  • winston.transports has changed from a dictionary to a list.

flovilmart and others added 5 commits December 29, 2018 14:01
* ⚡ Release 3.1.3

* Update CHANGELOG.md
Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.1.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](winstonjs/winston@2.4.4...3.1.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.5.1
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](winstonjs/winston-daily-rotate-file@v1.7.2...v3.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
@flovilmart
Copy link
Contributor

@pixel2 thanks! Those changes were expected. Can you have a look at the tests? Those seem to be failing on the CI.

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #5275 into master will decrease coverage by 1.7%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5275      +/-   ##
=========================================
- Coverage   93.91%   92.2%   -1.71%     
=========================================
  Files         123     123              
  Lines        8972    8970       -2     
=========================================
- Hits         8426    8271     -155     
- Misses        546     699     +153
Impacted Files Coverage Δ
src/Adapters/Logger/WinstonLoggerAdapter.js 61.53% <0%> (-23.08%) ⬇️
src/Adapters/Logger/WinstonLogger.js 100% <100%> (ø) ⬆️
src/Controllers/UserController.js 66.98% <0%> (-26.42%) ⬇️
src/Routers/PublicAPIRouter.js 75.49% <0%> (-15.69%) ⬇️
src/Routers/UsersRouter.js 81.04% <0%> (-12.42%) ⬇️
src/Routers/LogsRouter.js 88.23% <0%> (-5.89%) ⬇️
src/RestWrite.js 87.22% <0%> (-5.84%) ⬇️
src/Adapters/Storage/Mongo/MongoCollection.js 92.3% <0%> (-5.13%) ⬇️
src/Adapters/Auth/vkontakte.js 80% <0%> (-5%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22c39ed...30a88f3. Read the comment docs.

@pixel2
Copy link
Author

pixel2 commented Jan 3, 2019

The problem seemed to be related to the streams not closing properly. Even though the documentation says that a reconfiguration should remove all previous transports.

However I haven't looked at the log output, but there seem to be some changes in how Winston 3 handle formats. Not sure if that will affect logging in parse server.

@pixel2
Copy link
Author

pixel2 commented Jan 3, 2019

The failed tests in LoggerController are because of a bug in Winston 3.1 (winstonjs/winston#1130). There is an ugly workaround but a fix (winstonjs/winston#1434) has already been merged with master, so hopefully, it won't be that long until they release a new version.

@pixel2
Copy link
Author

pixel2 commented Jan 3, 2019

Just realized that https://github.com/winstonjs/winston/tree/master fixed the problem with not closing streams as well. Will revert those changes and wait for an updated Winston release.

@flovilmart
Copy link
Contributor

Yeah, there’s a pending Winston release that we need. Otherwise we’d need to keep the loggers on / change the way the server works completely around logging

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.2.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](winstonjs/winston@2.4.4...3.2.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.6.0
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](winstonjs/winston-daily-rotate-file@v1.7.2...v3.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
@flovilmart
Copy link
Contributor

flovilmart commented Jan 28, 2019

@pixel2 it looks like Winston has been updated. See #5326

@pixel2
Copy link
Author

pixel2 commented Jan 28, 2019

I've merged with #5326. Unfortunately, we had to fix our logging with the old adapter (Winston 2), so this is not as urgent for us anymore.

The Winston 3 was a bigger change than I first realized with changes to formatters and I haven't been able to analyze how this change affects the ParseServer logging.

@acinader acinader mentioned this pull request Mar 7, 2019
@stage88
Copy link
Contributor

stage88 commented Apr 8, 2019

Hi @pixel2, I might be able to pick this up if you don't mind, I am making some progress with tests.

See https://github.com/stage88/parse-server/tree/winston-3

@stage88
Copy link
Contributor

stage88 commented Apr 8, 2019

A small change in how winston logs messages, I'll update any statements that I find that could duplicate the message in the log file, for example log.error(err.message, err);.

From their readme:

NOTE: any { message } property in a meta object provided will
automatically be concatenated to any msg already provided: For
example the below will concatenate 'world' onto 'hello':

logger.log('error', 'hello', { message: 'world' });
logger.info('hello', { message: 'world' });

@acinader
Copy link
Contributor

thanks for getting this started @pixel2

#5496 almost there...

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.

6 participants