Ankündigung

Einklappen
Keine Ankündigung bisher.

Doppelte Logeinträge im Details File

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Doppelte Logeinträge im Details File

    Hi

    Ich schreibe grad an einem Plugin. Darin habe ich einträge wie z.B.

    Code:
            if self.has_iattr(item.conf, 'softliq_value'):
                self.logger.debug(f"parse item: {item.property.path}")
                query_value = self.get_iattr_value(item.conf, 'softliq_value')
                self._items[query_value]=item
                self.logger.debug(f"item: {item.property.path} added with query_value '{query_value}'")
                return self.update_item
    In der logging.yaml habe ich folgendes eingetragen:

    Code:
        plugins.softliq_sc:
            handlers: [shng_details_file]
            level: DEBUG
    Das funktioniert auch prinzipiell, aber es kommt im Details File alles doppelt:

    Code:
    2021-05-20  10:42:26 WARNING  lib.smarthome.main  --------------------   Init SmartHomeNG 1.8.2.master (5c3f6d20)   --------------------
    2021-05-20  10:42:26 WARNING  lib.smarthome.main  Running in Python interpreter 'v3.7.3 final', from directory /usr/local/smarthome
    2021-05-20  10:42:26 WARNING  lib.smarthome.main   - on Linux-5.10.17-v7+-armv7l-with-debian-10.9 (pid=32277)
    2021-05-20  10:42:27 WARNING  lib.smarthome.main   - Nutze Feiertage für Land 'DE', Provinz 'BY', benutzerdefinierte(r) Feiertag(e) nicht definiert
    2021-05-20  10:42:33 INFO     lib.network         Initializing a connection to 127.0.0.1 on TCP port 6720 with autoreconnect
    2021-05-20  10:42:33 DEBUG    lib.network         127.0.0.1 is a valid IP address
    2021-05-20  10:42:33 DEBUG    lib.network         '0.0.0.0' is a valid IP address
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  parse item: softliq.Aktualwerte.Durchfluss
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  parse item: softliq.Aktualwerte.Durchfluss
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  item: softliq.Aktualwerte.Durchfluss added with query_value 'D_A_1_1'
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  item: softliq.Aktualwerte.Durchfluss added with query_value 'D_A_1_1'
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  parse item: softliq.Aktualwerte.Restkapazitaet
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  parse item: softliq.Aktualwerte.Restkapazitaet
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  item: softliq.Aktualwerte.Restkapazitaet added with query_value 'D_A_1_2'
    2021-05-20  10:42:37 DEBUG    plugins.softliq_sc  item: softliq.Aktualwerte.Restkapazitaet added with query_value 'D_A_1_2'
    2021-05-20  10:42:38 DEBUG    lib.network         Starting connection cycle for 127.0.0.1
    2021-05-20  10:42:38 INFO     lib.network         Starting up TCP server socket 0.0.0.0:2323
    2021-05-20  10:42:38 DEBUG    lib.network         Connecting to 127.0.0.1 using IPv4 127.0.0.1 on TCP port 6720 with autoreconnect
    2021-05-20  10:42:38 INFO     lib.network         Connected to 127.0.0.1 on TCP port 6720
    2021-05-20  10:42:38 DEBUG    plugins.softliq_sc  Run method called
    2021-05-20  10:42:38 DEBUG    plugins.softliq_sc  Run method called
    2021-05-20  10:42:38 WARNING  lib.smarthome.main  --------------------   SmartHomeNG initialization finished   --------------------
    2021-05-20  10:42:38 DEBUG    plugins.softliq_sc  scheduler_add: name = plugins.softliq_sc.poll_softliQ, parameters: prio=3, cycle=60
    2021-05-20  10:42:38 DEBUG    plugins.softliq_sc  scheduler_add: name = plugins.softliq_sc.poll_softliQ, parameters: prio=3, cycle=60
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    2021-05-20  10:42:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    2021-05-20  10:43:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  url = http://192.168.178.23/mux_http
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  headers = {'Content-Type': 'application/xml'}
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    2021-05-20  10:44:49 DEBUG    plugins.softliq_sc  xml_data = getXML('id='+getCookie('id')+'&show=
    Ist das normal? Oder wie bekomme ich nur jeweils einen Eintrag?

    Gruß, Martin

    #2
    Da Du nur ein Fitzel der logging.yaml gepostet hast, muss ich die Glaskugel auspacken:

    Ich vermute, Du hast auch einen Eintrag
    Code:
        plugins:
            handlers: [shng_details_file]
            ...
    Dadurch wird Dein Logeintrag sowohl über Dein Logger der spezifisch für das Plugin ist, als auch durch den **plugins** Logger ausgegeben. Da beide Logger in die selbe Datei schreiben, hast Du den Logeintrag also 2 mal.

    Falls meine Glaskugel recht hat, reicht es, wenn Du in dem Plugin spezifischen Logger den **handler:** Eintrag raus nimmst (oder wie unten auskommentierst), also so:

    Code:
        plugins:
            handlers: [shng_details_file]
            ...
    
        plugins.softliq_sc:
            #handlers: [shng_details_file]
            level: DEBUG
    Viele Grüße
    Martin

    There is no cloud. It's only someone else's computer.

    Kommentar


      #3
      Deine Glaskugel hat völlig recht

      Und schon klappt das wie es soll.
      Sorry dafür dass ich nicht die komplette logging.yaml eingefügt habe. Da die ansonsten unangetastet war, habe ich nicht daran gedacht.

      Danke dir

      Martin

      Kommentar

      Lädt...
      X