Skip to content

Commit 082170b

Browse files
authored
Merge pull request #5 from kai-morich/standard-logging
use standard logging, similar to henne49/dbus-opendtu#173
2 parents 8e4a339 + a60029e commit 082170b

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ You have to edit `config.ini`. Please note the comments there as explanation!
4242

4343
| Config value | Explanation |
4444
|-------------------- | ------------- |
45-
| Logging | set loglevel for `current.log` respectivly `/var/log/dbus-d0-smartmeter/current.log`. Possible values among others are `DEBUG`, `INFO`, `WARING` |
45+
| Logging | set loglevel for `/var/log/dbus-d0-smartmeter/current`. Possible values among others are `DEBUG`, `INFO`, `WARING` |
4646
| SignOfLiveLog | if >0, interval in minutes to give stats (= number of received correct SML-data) |
4747
| CustomName | user-friendly name for the gridmeter within the Venus web-GUI |
4848
| TimeoutInterval | if no valid data is received within this millisencods-interval, the DBUS-service-property Connected will be set to 0 |
@@ -70,7 +70,7 @@ You do not have to modify serial-starter.rules beause `service/run` stops the co
7070

7171
If you have good luck, just run `install.sh` and the gridmeter appears within the Venus-GUI.
7272

73-
`current.log` will look like this:
73+
`/var/log/dbus-d0-smartmeter/current` will look like this:
7474

7575
````
7676
2023-05-31 19:13:16,534 root INFO Starting...

dbus-d0-smartmeter.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# import normal packages
44
import logging
5-
from logging.handlers import RotatingFileHandler
65
import sys
76
import os
87
import platform
@@ -424,12 +423,7 @@ def main():
424423
logging.basicConfig( format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
425424
datefmt='%Y-%m-%d %H:%M:%S',
426425
#level=logging.DEBUG,
427-
level=config['DEFAULT']['Logging'],
428-
handlers=[
429-
#logging.FileHandler("%s/current.log" % (os.path.dirname(os.path.realpath(__file__)))),
430-
RotatingFileHandler('%s/current.log' % (os.path.dirname(os.path.realpath(__file__))), maxBytes=1000000, backupCount=3),
431-
logging.StreamHandler()
432-
])
426+
level=config['DEFAULT']['Logging'])
433427

434428
try:
435429
logging.info("Starting...");

service/log/run

100644100755
+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
#!/bin/sh
2-
#set -x
3-
SCRIPT_DIR=$( realpath $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) )
4-
SERVICE_NAME=$( basename $( realpath $SCRIPT_DIR/../.. ) )
52
exec 2>&1
6-
exec multilog t s25000 n4 /var/log/$SERVICE_NAME
3+
exec multilog t s25000 n4 /var/log/dbus-d0-smartmeter

0 commit comments

Comments
 (0)