Page 2 of 2

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 9:30
by gizmocuz
Kedi wrote: Monday 08 July 2024 9:09 I understand that it is a done case.
But please remove the line, it makes no sense.

Code: Select all

Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
I agree with you, but this message was there before.
You can disable this message with the checkbox'Log 'event script triggers'' (uncheck this) under Settings->Other

I guess when you use a lua script, or maybe a script outside the internal editor, you do get the real filename here... no idea... not my code

Hope someone knows this and sees another filename here

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 10:18
by Kedi
Tnx, Now I got rid of that message.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 13:02
by McMelloW
waltervl wrote: Monday 08 July 2024 8:15 With default log level in settings
info,status,error,execution info
and no log level defined I get below with the test script.

When I set LOG_INFO in the script I get no execution lines (as expected)

Code: Select all

 2024-07-08 08:10:55.976 Status: User: admin (IP: 192.168.1.58) initiated a switch command (107/Test/On)
2024-07-08 08:10:55.979 Dummy: Light/Switch (Test)
2024-07-08 08:10:56.007 dzVents: Handling events for: "Test", value: "On"
2024-07-08 08:10:56.007 dzVents: log_script: ------ Start internal script: logging_test: Device: "Test (Dummy)", Index: 107
2024-07-08 08:10:56.007 dzVents: log_script: INFO log line!
2024-07-08 08:10:56.007 Status: dzVents: log_script: STATUS log line!
2024-07-08 08:10:56.007 Error: dzVents: log_script: ERROR log line!
2024-07-08 08:10:56.007 dzVents: log_script: ------ Finished logging_test 
When I try this, with no log settings in the script, I only get these 2 lines. Where are the execution and info lines

Code: Select all

2024-07-08 12:55:42.732 Status: User: mcmellow (IP: 192.168.123.16) initiated a switch command (291/Test-Switch/Off)
2024-07-08 12:55:42.880 Status: dzVents: STATUS log line!
2024-07-08 12:55:42.880 Error: dzVents: ERROR log line!
Does this also has anything to do with the DAEMON_ARGS setting in /etc/init.d/domoticz.sh

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 13:43
by waltervl
McMelloW wrote: Monday 08 July 2024 13:02
When I try this, with no log settings in the script, I only get these 2 lines. Where are the execution and info lines


Does this also has anything to do with the DAEMON_ARGS setting in /etc/init.d/domoticz.sh
What are your settings in menu Setup, Settings, Tab Other, Dzvents logging ? As shown in screenshots earlier in this topic....
It should be at least "Info,Status, Error"
If only "Status,Error" you only will get Status and Error messages in the log and no Info.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 14:08
by McMelloW
waltervl wrote: Monday 08 July 2024 13:43
What are your settings in menu Setup, Settings, Tab Other, Dzvents logging ? As shown in screenshots earlier in this topic....
It should be at least "Info,Status, Error"
If only "Status,Error" you only will get Status and Error messages in the log and no Info.
The setup, settings... etc are: info,status,error,execution info.
The loglevel lines including logging = { .... }, in the script are marked out.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 14:54
by lost
gizmocuz wrote: Monday 08 July 2024 9:30 I guess when you use a lua script, or maybe a script outside the internal editor, you do get the real filename here... no idea... not my code
Hope someone knows this and sees another filename here
Yes, all my scripts are external and I have full script path/name:

Code: Select all

grep EventSystem /tmp/domoticz.txt 
2024-07-08 14:46:28.034  Status: EventSystem: Script event triggered: /home/domo/domoticz/scripts/lua/script_device_smartMeter.lua
2024-07-08 14:46:33.163  Status: EventSystem: Script event triggered: /home/domo/domoticz/scripts/lua/script_device_smartMeter.lua
But this only shows up if, in Parameters/Others, I set the middle switch in the Events section (still in 2024.4, if this now changed). I only set this for debug if I want to verify a script is triggered, usually I don't have this set and no such logs. So when useless/internal there is already a way to get rid of this.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 15:43
by waltervl
McMelloW wrote: Monday 08 July 2024 14:08
waltervl wrote: Monday 08 July 2024 13:43
What are your settings in menu Setup, Settings, Tab Other, Dzvents logging ? As shown in screenshots earlier in this topic....
It should be at least "Info,Status, Error"
If only "Status,Error" you only will get Status and Error messages in the log and no Info.
The setup, settings... etc are: info,status,error,execution info.
The loglevel lines including logging = { .... }, in the script are marked out.
This what I had changed to get previous mentioned results. Default settings were info,status,error,execution info. Perhaps you did not press on Save Changes in settings?

Code: Select all

	logging = {
		marker = 'log_script',
		-- level = domoticz.LOG_DEBUG
	},

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 15:58
by McMelloW
log settings in /etc/init.d/domoticz.sh

DAEMON_ARGS="$DAEMON_ARGS -loglevel status,error" # these loglevels will make it to the logfile

log settings in setup, settings, others, dzVents = Info, Status, Errors, Executions Info Yes, save changes is done.

logging in script = none, the line is marked out with -- Here you see the results of the log when I trigger the log-level script with a dummy switch

Code: Select all

2024-07-08 15:47:11.347 Status: EventSystem: reset all events...
2024-07-08 15:47:11.349 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/EnergyConsumption.lua
2024-07-08 15:47:11.350 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/SimSolarBattery.lua
2024-07-08 15:47:11.350 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/KM2-Zonneboiler.lua
2024-07-08 15:47:11.351 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/SolarEdgeStatus.lua
2024-07-08 15:47:11.351 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/TestLogLevel.lua
2024-07-08 15:47:24.721 Status: User: mcmellow (IP: 192.168.123.16) initiated a switch command (291/Test-Switch/On)
2024-07-08 15:47:24.811 Status: dzVents: log-level: STATUS log line!
2024-07-08 15:47:24.812 Error: dzVents: log-level: ERROR log line!
2024-07-08 15:47:26.309 Status: User: mcmellow (IP: 192.168.123.16) initiated a switch command (291/Test-Switch/Off)
2024-07-08 15:47:26.430 Status: dzVents: log-level: STATUS log line!
2024-07-08 15:47:26.430 Error: dzVents: log-level: ERROR log line!
I have tried another script and set logging to level = domoticz.LOG_DEBUG. In this script are a number of lines to show values with domoticz.LOG_DEBUG And none of these lines showed up in the log. Where else is the logging set for dzVents scripts

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 16:37
by Kedi
lost wrote: Monday 08 July 2024 14:54
gizmocuz wrote: Monday 08 July 2024 9:30 I guess when you use a lua script, or maybe a script outside the internal editor, you do get the real filename here... no idea... not my code
Hope someone knows this and sees another filename here
Yes, all my scripts are external and I have full script path/name:

Code: Select all

grep EventSystem /tmp/domoticz.txt 
2024-07-08 14:46:28.034  Status: EventSystem: Script event triggered: /home/domo/domoticz/scripts/lua/script_device_smartMeter.lua
2024-07-08 14:46:33.163  Status: EventSystem: Script event triggered: /home/domo/domoticz/scripts/lua/script_device_smartMeter.lua
But this only shows up if, in Parameters/Others, I set the middle switch in the Events section (still in 2024.4, if this now changed). I only set this for debug if I want to verify a script is triggered, usually I don't have this set and no such logs. So when useless/internal there is already a way to get rid of this.
For me now it is a BIG question mark. I have all my scripts external and always had and have this line.

Code: Select all

/home/pi/domoticz/dzVents/runtime/dzVents.lua
In my startup I have.

Code: Select all

DAEMON_ARGS="$DAEMON_ARGS -loglevel normal,status,error"
In my scripts always.

Code: Select all

    logging =
    {   marker = 'AutoOff',
        level = domoticz.LOG_INFO,
--      level = domoticz.LOG_DEBUG,
    },
And switch between LOG_INFO and LOG_DEBUG only when I have to debug. My 'middle' switch is normally green.
What could be difference between our settings?

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 16:52
by Kedi
Oke, I see the difference now -> script_device_ in lua dir.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 17:16
by waltervl
@McMellow By default there is no loglevel argument in domoticz.sh

https://github.com/domoticz/domoticz/bl ... omoticz.sh

So you could try by removing it.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 19:48
by willemd
gizmocuz wrote: Monday 08 July 2024 7:17 .....
There is also another setting 'Log event script triggers', is that enabled or disabled?

...
Thanks, that at least removed the useless messages....

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 21:11
by McMelloW
waltervl wrote: Monday 08 July 2024 17:16 @McMellow By default there is no loglevel argument in domoticz.sh

https://github.com/domoticz/domoticz/bl ... omoticz.sh

So you could try by removing it.
Thanks for your advice.
These loglevel arguments were put in domoticz.sh a long time ago to suppress a lot of messages. Some of my hardware was set to debug as well as info, status and error. I have checked all hardware settings and put them to a more normal stable situation.

Playing with the loglevel test script shows the different results of the loglevels. Thanks for all the support with this subject. It is very helpful. 👍👍

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 22:53
by janpep
Both @waltervl and @gizmocuz thank for your support and all attempts to help people.
gizmocuz wrote: Monday 08 July 2024 8:11 I guess your previous Domoticz update was ~6 months ago?
I went to 2024.4 very soon after it was available.
So, the idea rose to have a global way of turning this off. Hence the new Log Levels in the application settings. The default level (when you install Domoticz new) is still Info+Status+Error+Exec_Info. It is possible some users did change this level previously and they experience a different log level.

But still, if you set this to Status+Error, you can override this in your script

This is also explained in the dzVents manual that can be found on our WIKI (logging = { … } (optional))

And this is also why a new example template is available called 'Logging' that you can use as tutorial.

The idea is to remove/mark all "logging = { … } (optional)" in your scripts when the script is finished so the application default level will apply.
When you need extensive script logging you can use LOG_DEBUG there
Indeed, I want that extensive logging, but only for the script I am working on. Like Kedi, until now I set it to INFO or DEBUG in the script itself.

You gave an explanation on what changed in the new version and of how it should work, But it doesn't seem like a response to my findings.

Meanwhile update 2024.6 installed, did all the cache clean-up and tried again. Still this is very confusing for me and I do not consider myself the most stupid in this area.

Earlier I already had understood, that when notyhing is specified, the general setting is used and that a specification in the script will override that. In the quote above you confirm this. My point however was clear! When I test this, that does not seem to be the case.

1. I have set the general Settings --> Other now to: 'Info, Status, Erros, Execution Info'.
2. In the template, I set the level = domoticz.LOG_DEBUG
3. Then I run the template.
4. I expect to see now all four template lines (INFO, STATUS, ERROR, DEBUG.) in URL/#/Log.

But the result is still:

Code: Select all

2024-07-08 22:22:43.523 Status: dzVents: logtest: STATUS log line!
2024-07-08 22:22:43.523 Error: dzVents: logtest: ERROR log line!
I hope I am missing something stupid here, but I'm going around in circles now.

Re: dzVents: Logfile has less info

Posted: Monday 08 July 2024 23:09
by janpep
OOPS.
Maybe stupid or perhaps the result of the way of working so far, because of how it turned out to be convenient to work.
For the script logging I always went to see my DEBUG information in tab STATUS. This filtered out already a lot of noise comming from the devices.
So this became my standard place to look at.
I just found the missing info under tab ALL :oops:

Re: dzVents: Logfile has less info

Posted: Tuesday 09 July 2024 8:24
by gizmocuz
How bizarre right? Because before my changes everything ended in ALL (as all logs were handled as INFO internally in Domoticz)
Now you do have the Status and Error logs in their correct tabs/places. :ugeek:

Re: dzVents: Logfile has less info

Posted: Tuesday 09 July 2024 11:49
by janpep
gizmocuz wrote: Tuesday 09 July 2024 8:24 Now you do have the Status and Error logs in their correct tabs/places. :ugeek:
May I elaborate a little more on this? I understaqnd that these tabs are a kind of filter that show STATUS and ERROR logs.
For what purpose was the status log created? What would I use it for? I'm thinking of giving a LOG_STATUS in every script, which displays the end result? e.g. Air conditioning is turned off or the success or failure of a certain script or action.
In that case the tab Status gives a nice overview of these results. Does that make sense?