MQTT log levels & log rotation
-
Trying to set log level for MQTT to the lowest possible, is it in practise level 4? Also, would like to set maximum size and log rotation, but the following setup in logging.yaml did not work:
MQTTController: level: 4 streams: - type: file maxsize: 2 keep: 2
Using the latest build (23010).
-
Trying to set log level for MQTT to the lowest possible, is it in practise level 4? Also, would like to set maximum size and log rotation, but the following setup in logging.yaml did not work:
MQTTController: level: 4 streams: - type: file maxsize: 2 keep: 2
Using the latest build (23010).
@tunnus said in MQTT log levels & log rotation:
Trying to set log level for MQTT to the lowest possible, is it in practise level 4?
Four (4) is the default level, which logs information and more severe messages. The severities are critical (0), error (1), warning (2), notice (3), information (4), and debug levels 5 through 9 inclusive.
@tunnus said in MQTT log levels & log rotation:
Also, would like to set maximum size and log rotation, but the following setup in logging.yaml did not work
Good on you for showing the config so, but from the posting guidelines:
... if you say "I tried to do X but it didn't work", you need to show what you tried to do, and you need to explain what you expected, what happened, and how that didn't meet your expectations
-
Okay, if I ask the other way around, so if max size & rotation for the "main" log file is set as shown below, how do you set the same for MQTTController?
logging: default: level: 4 streams: - type: console level: 0 - type: file name: "reactor.log" maxsize: 2 # megabytes max size keep: 5 # copies of old logs
-
Just the way you've done it. I'm still wanting some narrative of what you expected to see vs what is happening, because I think just you thinking about how to write that might have led you to solving your own problem.
I'm pretty sure it's as simple as, you haven't told the configuration what file to send the log to... you need to add a
name
field instreams
for theMQTTController
section, so it knows what file name to use for that log stream.MQTTController: level: 4 streams: - type: file name: mqtt.log maxsize: 2 keep: 2
If you don't want it to log to a separate file, just the regular
reactor.log
file (i.e. you only want to change MQTTController's log level, not its output destination), then remove the entirestreams
section from yourMQTTController
section, so it's just:MQTTController: level: 4
-
Now I have the following configuration, but the file grows over 4 MB (does not rotate)
MQTTController: level: 4 streams: - type: file name: mqtt-topics.log maxsize: 4 keep: 2
Just realized I have "log_topics" in reactor.yaml's mqtt section which may or may not interfere with this logging setup?
-
Now I have the following configuration, but the file grows over 4 MB (does not rotate)
MQTTController: level: 4 streams: - type: file name: mqtt-topics.log maxsize: 4 keep: 2
Just realized I have "log_topics" in reactor.yaml's mqtt section which may or may not interfere with this logging setup?
@tunnus topic logging is separate. Remember that 4MB is 4,194,304 bytes, not 4,000,000. The last message logged before rotation may cause the file to be slightly larger.
-
T toggledbits locked this topic on