Skip to content

Commit

Permalink
debug logging doesn't immediately flush anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
retrodaredevil committed May 10, 2020
1 parent 535fe1b commit 5c5ac4b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Ready to install? Use the [Quickstart](other/docs/quickstart.md)!
* Fully customizable through JSON (**No programming experience required**).
* Supports CouchDB, InfluxDB, local JSON file, and PVOutput exporting.
* Can [report Raspberry Pi CPU temperature](other/docs/raspberry_pi_cpu_temperature.md).
* Easy setup on Linux. Runs *without* root.

## Supported Databases
* CouchDB
Expand Down
10 changes: 7 additions & 3 deletions client/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<Properties>
<Property name="logPath">logs</Property>
<Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</Property>
<Property name="filePermissions">rw-rw-r--</Property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<MarkerFilter marker="NO_CONSOLE" onMatch="DENY" onMismatch="NEUTRAL"/>
<PatternLayout pattern="${LOG_PATTERN}"/>
</Console>
<RollingFile name="logAll" fileName="${logPath}/log_debug.log" filePattern="${logPath}/log_debug_%d{yyyy.MM.dd}-%i.log.gz">
<RollingFile name="logAll" fileName="${logPath}/log_debug.log" filePattern="${logPath}/log_debug_%d{yyyy.MM.dd}-%i.log.gz"
immediateFlush="false" bufferSize="16384" filePermissions="${filePermissions}">
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<OnStartupTriggeringPolicy />
Expand All @@ -23,7 +25,8 @@
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="logInfo" fileName="${logPath}/log_info.log" filePattern="${logPath}/log_info_%d{yyyy.MM.dd}-%i.log.gz">
<RollingFile name="logInfo" fileName="${logPath}/log_info.log" filePattern="${logPath}/log_info_%d{yyyy.MM.dd}-%i.log.gz"
filePermissions="${filePermissions}">
<PatternLayout pattern="${LOG_PATTERN}"/>
<Policies>
<OnStartupTriggeringPolicy />
Expand All @@ -37,7 +40,8 @@
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="logSummary" fileName="${logPath}/log_summary.log" filePattern="${logPath}/log_summary_%d{yyyy.MM.dd}-%i.log.gz">
<RollingFile name="logSummary" fileName="${logPath}/log_summary.log" filePattern="${logPath}/log_summary_%d{yyyy.MM.dd}-%i.log.gz"
filePermissions="${filePermissions}">
<PatternLayout pattern="${LOG_PATTERN}"/>
<MarkerFilter marker="SUMMARY" onMatch="ACCEPT" onMismatch="DENY"/>
<Policies>
Expand Down
11 changes: 11 additions & 0 deletions other/docs/raspberry_pi_cpu_temperature.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ This works by using the `vcgencmd measure_temp` that is only available on Raspbe
You can see an example [here](../../config_templates/base/mate_template_with_rpi_cpu_temperature.json)

If you have any suggestions for statistics to add, feel free to request them!

### What to try when this doesn't work
If you have everything else in SolarThing working normally, but this isn't working, there are a few things you can try.

If you are using the systemd service, it should be configured to run as the user 'solarthing'. If SolarThing was
set up correctly, the user 'solarthing' should be a member of the group 'video'. You can make sure this is the case by
running `groups solarthing` and make sure 'video' appears. If it doesn't, the easiest thing to do is to run `/other/linux/create_user.sh`
which will make sure the 'solarthing' user is in the correct groups.

If that doesn't work, make sure you have everything spelled correctly in 'extra_option_flags'. And if that still doesn't work,
drop by [our issues page](https://github.com/wildmountainfarms/solarthing/issues) and give us a section of your `log_debug.log` file.
8 changes: 5 additions & 3 deletions other/linux/create_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ fi

# Add user
if ! id -u solarthing >/dev/null 2>&1; then
useradd -r -g solarthing solarthing 2>/dev/null
useradd -r -g solarthing -G dialout,video solarthing 2>/dev/null # create user with correct groups
if ! id -u solarthing >/dev/null 2>&1; then
echo Unable to create user
exit 1
fi
passwd -l solarthing || (echo Could not lock solarthing passwd; exit 1)
fi
# Add user to groups
usermod -a -G dialout solarthing || exit 1 # Add solarthing to 'dialout`, which allows access to serial ports
usermod -a -G dialout,video solarthing || exit 1 # add groups to user just to make sure they have all needed groups
# dialout is for serial port access
# video is for 'vcgencmd' command

echo Created \"solarthing\" user and group.
echo You can add a user to the group with \"adduser \<USER NAME HERE\> solarthing\".
echo You need to log out and log back in after changing groups.
echo You need to log out and log back in after adding groups.

#echo The groups you probably need to be a part of are \(These are the Raspberry Pis default:\):
#echo solarthing adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
Expand Down

0 comments on commit 5c5ac4b

Please sign in to comment.