zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Zigbee2MQTT fails to start after adding log_output paramet

Open OlsiIgitt opened this issue 4 years ago • 8 comments

What happened?

When I add the line 'log_output: file' (dots -> spaces)

advanced: ..log_output: file

then Zigbee2MQTT will always crash after starting with following information in cmd window:

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: node index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Z2M is running under Windows 10 !

What did you expect to happen?

All information should be logged (inclusively debug information) into log file without crash.

How to reproduce it (minimal and precise)

add following lines to configuration.yaml:

advanced: log_output: file

Zigbee2MQTT version

1.25.0

Adapter firmware version

CC1352P2_CC2652P_launchpad_coordinator_20220219

Adapter

Zigbee 3.0 USB Dongle Plus

Debug log

Nothing -> no log file created

OlsiIgitt avatar Apr 18 '22 09:04 OlsiIgitt

log_output? try these commands below - works for me

advanced: ..log_directory: /var/log/zigbee2mqtt ..log_file: zigbee2mqtt.log

lux73 avatar Apr 18 '22 15:04 lux73

I tried:

advanced: ..log_level: debug ..log_directory: c:\progs\z2m\data\test ..log_output: test.log

Same effect: Crash... I remind: I am using Windows.

OlsiIgitt avatar Apr 18 '22 15:04 OlsiIgitt

please try log_file

log_output is not the correct command -> https://www.zigbee2mqtt.io/guide/configuration/logging.html#logging

lux73 avatar Apr 18 '22 15:04 lux73

I tried this:

advanced: ..log_level: debug ..log_directory: c:\progs\z2m\data\test ..log_file: test.log .. #log_output: test.log

This will work, but activating 'log_output' makes Z2M crash with 100 % certainty (Windows); indepent of paramters I try behind "log_output: ".

log_output is not the correct command -> https://www.zigbee2mqtt.io/guide/configuration/logging.html#logging

There I can find the statement:

'# Optional: Output location of the log (default: shown below), leave empty to supress logging (log_output: []) '# possible options: 'console', 'file', 'syslog' ' log_output: ' - console ' - file

What does it mean???

OlsiIgitt avatar Apr 18 '22 16:04 OlsiIgitt

log output should be an array, see the docs: https://www.zigbee2mqtt.io/guide/configuration/logging.html, so e.g. log_output: ["console", "file"]

Koenkk avatar Apr 18 '22 17:04 Koenkk

Thanks, Koen.

' log_output: [file]' or ' log_output: [file, console]' etc. works fine.

Sorry, the reason for the problem was my poor knowledge of JavaScript. Honestly the only thing I know about JS is, that it exists. Possibly the word "array" in the description could have helped. Or another example like above besides ' log_output: []'?

But what is not a JS thing: When I make mistakes in defining ' log_directory: ...' (or others), I will get an comprehensive information from Z2M about that. Doing mistakes with ' log_output: ...' Z2M punishes me with absolutely no message, no matter if ' log_level: debug' or not.

Bye...

OlsiIgitt avatar Apr 19 '22 07:04 OlsiIgitt

You should already get an error message, I've added the following to my configuration.yaml:

advanced:
  log_output: file

Next I did an npm start:

image

Koenkk avatar Apr 20 '22 14:04 Koenkk

You are absolutely right. I apologize for that. I only had eyes for the red marked error messages...

I vow to do better.

OlsiIgitt avatar Apr 20 '22 14:04 OlsiIgitt