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

Flush logger before exiting process #10904

Closed
wants to merge 50 commits into from

Conversation

joshuaspence
Copy link
Contributor

I am using the file logger without the console logger and if Z2M is unable to start then nothing is logged because process.exit(1) is calling and WInston doesn't flush async logs when this happens (see winstonjs/winston#1629).

With console logging enabled:

Zigbee2MQTT:info  2022-01-20 05:01:21: Logging to console and directory: '/app/data' filename: z2m.log
Zigbee2MQTT:info  2022-01-20 05:01:21: Starting Zigbee2MQTT version 1.22.2-dev (commit #)
Zigbee2MQTT:info  2022-01-20 05:01:21: Starting zigbee-herdsman (0.14.1)
Zigbee2MQTT:error 2022-01-20 05:01:21: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-01-20 05:01:21: Failed to start zigbee
Zigbee2MQTT:error 2022-01-20 05:01:21: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-01-20 05:01:21: Exiting...
Zigbee2MQTT:error 2022-01-20 05:01:21: Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyACM0'
    at SerialPort.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:146:28)
    at SerialPort._error (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
    at /app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12

With file logging:

info  2022-01-20 05:03:36: Logging to directory: '/app/data' filename: z2m.log
info  2022-01-20 05:03:36: Starting Zigbee2MQTT version 1.22.2-dev (commit #)
info  2022-01-20 05:03:36: Starting zigbee-herdsman (0.14.1)
error 2022-01-20 05:03:36: Error while starting zigbee-herdsman

Koenkk and others added 30 commits January 1, 2022 10:47
* Fix typo: suppress

* Fix typo: discovered
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
)

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
* Update zigbee-herdsman-converters to 14.0.367

* Update publish.test.js

Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: nurikk <nurikk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
* Add a configuration option to override OTA index file

* Cleanup

* Code review corrections

* Move zigbee_ota_override_index_location to ota section of the configuration file

* Suport both local and remote (HTTP) OTA override index files

* Updates

* updates

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* -

* deep copy schema

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -

* -
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
github-actions bot and others added 20 commits January 10, 2022 18:33
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
* dump

* updates

* Updates
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
Co-authored-by: Koenkk <Koenkk@users.noreply.github.com>
@joshuaspence joshuaspence changed the title Flush logger Flush logger before exiting process Jan 20, 2022
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