-
Notifications
You must be signed in to change notification settings - Fork 2
SolarNode Logging
SolarNode
This guide describes how to configure the SolarNode logging system so that logs are written directly to persistent storage, rather than the default configuration of using temporary (RAM) storage that is lost across reboots.
Note that this configuration adds a lot of stress to the node's storage medium, typically an SD card. Use of this configuration should be used with caution.
The following logging configuration creates the following log files:
-
/var/log/solarnode/solarnode.log
- the main log -
/var/log/solarnode/mqtt-solarin.log
- MQTT wire logging to SolarIn -
/var/log/solarnode/mqtt-solarflux.log
- MQTT wire logging to SolarFlux
Edit the /etc/solarnode/log4j.properties
file, replacing the fileAppender
section at the end
with the following:
log4j.logger.net.solarnetwork.mqtt.queue = TRACE, mqtt
log4j.additivity.net.solarnetwork.mqtt.queue = false
log4j.logger.net.solarnetwork.mqtt.influx = TRACE, flux
log4j.additivity.net.solarnetwork.mqtt.influx = false
log4j.appender.fileAppender = org.apache.log4j.RollingFileAppender
log4j.appender.fileAppender.layout = org.apache.log4j.PatternLayout
log4j.appender.fileAppender.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}; %m%n
log4j.appender.fileAppender.File = /var/log/solarnode/solarnode.log
log4j.appender.fileAppender.MaxFileSize = 5MB
log4j.appender.fileAppender.MaxBackupIndex = 9
log4j.appender.fileAppender.BufferedIO = true
#log4j.appender.fileAppender.BufferSize = 64
# NOTE: found that BufferSize is ignored in RollingFileAppender :-(
log4j.appender.mqtt = org.apache.log4j.RollingFileAppender
log4j.appender.mqtt.layout = org.apache.log4j.PatternLayout
log4j.appender.mqtt.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}; %m%n
log4j.appender.mqtt.File = /var/log/solarnode/mqtt-solarin.log
log4j.appender.mqtt.MaxFileSize = 10MB
log4j.appender.mqtt.MaxBackupIndex = 9
log4j.appender.mqtt.BufferedIO = true
#log4j.appender.mqtt.BufferSize = 4096
log4j.appender.flux = org.apache.log4j.RollingFileAppender
log4j.appender.flux.layout = org.apache.log4j.PatternLayout
log4j.appender.flux.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}; %m%n
log4j.appender.flux.File = /var/log/solarnode/mqtt-solarflux.log
log4j.appender.flux.MaxFileSize = 10MB
log4j.appender.flux.MaxBackupIndex = 9
log4j.appender.flux.BufferedIO = true
#log4j.appender.flux.BufferSize = 8192
For the MQTT wire logging to be enabled, it must be activated with a special configuration file.
Create the /etc/solarnode/services/net.solarnetwork.common.mqtt.netty.cfg
file with this content:
wireLogging = true