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

Enhance error Logging #5647

Closed
wants to merge 2 commits into from
Closed

Enhance error Logging #5647

wants to merge 2 commits into from

Conversation

rrg92
Copy link
Contributor

@rrg92 rrg92 commented Sep 16, 2022

This will enhance the logging of error messages in catch blocks (the javascript Error object).

Due to a problem on wiston, when logging an error object, the winston just prints the messages, and all important details (like error line, etc,) is hidden. Details: winstonjs/winston#1338

For example, if I'm developing a module or something fails with an Error, this is what is printed in the wiki.js log:

image

After this fix, the error is printed with more info:

image

This will enhance the logging of error messages in catch blocks (the javascript Error object).

Due to a problem on wiston, when logging an error object, the winston just prints the messages, and all important details (like error line, etc,) is hidden.
Details: winstonjs/winston#1338

For example, if I'm developing a module or something fails with an Error, this is what is printed in the wiki.js log:


2022-09-16T02:31:41.383Z [MASTER] info: =======================================
2022-09-16T02:31:41.385Z [MASTER] info: = Wiki.js 2.5.286 =====================
2022-09-16T02:31:41.385Z [MASTER] info: =======================================
2022-09-16T02:31:41.386Z [MASTER] info: Initializing...
2022-09-16T02:31:42.334Z [MASTER] info: Using database driver pg for postgres [ OK ]
2022-09-16T02:31:42.337Z [MASTER] info: Connecting to database...
2022-09-16T02:31:42.501Z [MASTER] info: Database Connection Successful [ OK ]
2022-09-16T02:31:43.507Z [MASTER] warn: Mail is not setup! Please set the configuration in the administration area!
2022-09-16T02:31:43.675Z [MASTER] info: Loading GraphQL Schema...
2022-09-16T02:31:45.155Z [MASTER] info: GraphQL Schema: [ OK ]
2022-09-16T02:31:45.437Z [MASTER] error: SOME_ERROR is not defined




After this fix, the error is printed with more info:


Loading configuration from T:\powerdocs\wikijs\config.yml... OK
2022-09-16T02:32:08.650Z [MASTER] info: =======================================
2022-09-16T02:32:08.652Z [MASTER] info: = Wiki.js 2.5.286 =====================
2022-09-16T02:32:08.653Z [MASTER] info: =======================================
2022-09-16T02:32:08.653Z [MASTER] info: Initializing...
2022-09-16T02:32:09.627Z [MASTER] info: Using database driver pg for postgres [ OK ]
2022-09-16T02:32:09.632Z [MASTER] info: Connecting to database...
2022-09-16T02:32:09.897Z [MASTER] info: Database Connection Successful [ OK ]
2022-09-16T02:32:10.932Z [MASTER] warn: Mail is not setup! Please set the configuration in the administration area!
2022-09-16T02:32:11.116Z [MASTER] info: Loading GraphQL Schema...
2022-09-16T02:32:12.949Z [MASTER] info: GraphQL Schema: [ OK ]
2022-09-16T02:32:13.276Z [MASTER] error: ReferenceError: SOME_ERROR is not defined
    at module.exports (T:\wikijs\server\master.js:172:3)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.bootMaster (T:\wikijs\server\core\kernel.js:60:9)
@auto-assign auto-assign bot requested a review from NGPixel September 16, 2022 02:40
@rrg92 rrg92 changed the title Enhance Loggin Enhance error Logging Sep 16, 2022
@rrg92 rrg92 closed this Feb 15, 2023
@rrg92 rrg92 deleted the patch-1 branch February 15, 2023 11:52
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.

2 participants