-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[addons] Less debug log entries when accessing settings #17822
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If log spam is identified in a loop, then removing it makes usually sense.
Back port to Leia possible? |
@@ -683,8 +676,6 @@ std::shared_ptr<CSettingCategory> CAddonSettings::ParseOldCategoryElement(uint32 | |||
|
|||
bool CAddonSettings::InitializeFromOldSettingDefinitions(const CXBMCTinyXML& doc) | |||
{ | |||
m_logger->debug("trying to load setting definitions from old format..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe keep this one and encourage add-on developers to migrate to the new settings format? If we remove this on v20 we should probably advise in v19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anywhere the warning could go that only shows once per addon call? Currently it shows every time a setting is read.
I think still best to remove. As having it puts it in all users logs (not just devs). An addon dev should be familiar with changes and be reading the forum posts in regards to depreciations etc. Eg. There is no warning in 18 about python2 being depreciated in 19? But most addon devs I'm sure are quite aware by now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should only show when loading the settings for an add-on. It shouldn't show on every access to the setting from the same script. Otherwise something else is wrong. But I agree that it is logged out too often especially for non-service add-ons. But for debugging setting issues it's still important information to know that Kodi tries to load old style settings.
So if we can find a way to show it once for every add-on with settings that's ok with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ill double check when it's getting logged.
Could leave in 19 and remove from 18 (if back port)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe keep this one and encourage add-on developers to migrate to the new settings format?
are there any guidelines?
the last time i made a conversion (last year) attempt i noticed a lack of ability to run "actions" with python add-on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this logged all the time and my addons use the new setting format. Does it default to checking the old format first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For add-ons using the old settings style logging should look like this:
loading setting definitions
trying to load setting definitions from old format...
For add-ons using the new settings style logging should look like this:
loading setting definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, you are correct. I had mixed up Leia (old settings) vs Matrix (new settings).
@@ -684,7 +677,7 @@ std::shared_ptr<CSettingCategory> CAddonSettings::ParseOldCategoryElement(uint32 | |||
bool CAddonSettings::InitializeFromOldSettingDefinitions(const CXBMCTinyXML& doc) | |||
{ | |||
m_logger->debug("trying to load setting definitions from old format..."); | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the white space at the end of the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, my editor adds that on new lines.
Removed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthuisman any chance you want to quickly fix this up so we can get it merged when you have some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitespace? It is already fixed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fuzzard oops - your right - now should be fixed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cheers mate. ill merge it when jenkins finishes
Thanks @matthuisman I have raised this log spam issue a number of times previously. Will make the logs easier to read and smaller for the paste sites. |
another thing I need to look into $ADDON[addon_id 32035] doesn't work for lvalues in settings.xml I reuse a lot of settings / language strings from a common add-on. Trying to keep a single add-on code working over all kodi versions is getting tricky. Be nice if we could ship a settings.old.xml or something to keep backwards compatible :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthuisman I think the statement you are removing is primarily printed when you have a setting in your settings.xml which is not used by the addon. The logging is verbose if you have extra unused settings. But then maybe it should be.
I only see the settings loaded one time in the log in matrix.
it shows if you had a setting in the userdata settings.xml but not in the addons setting.xml You can test by just adding a setting in settings.xml we should be able to remove old settings and not spam the log? |
I thinks that’s reasonable. And maybe create a backup and then remove the older settings. At least the user still has access to the data then. |
addons shouldn't be manually editing the userdata settings.xml and having to parse xml to remove old settings? Its fine if that old setting sits there - but it shouldn't start spamming the log. If a setting is in userdata settings.xml and not in add-on settings.xml - then it should just ignore it. For the user to get rid of that message, they need to manually open the userdata settings.xml and remove the entry for that old setting. Thats not very friendly? I think the main problem is the verobosity of the logging. If the addon tries to get a setting that doesn't exist anymore, we still get the |
I don't think that will work since I didn't even know it was possible. |
IIRC the reason I added this log message in the first place was because someone pointed out that with the old settings it must be possible to create settings which don't exist in the add-on's |
Yeh, I only found you could do it for most of the labels the other day. You still get the "CSettingsManager: requested setting ({}) was not found" if you try to access a setting that isn't in the settings.xml. Thats fine. That tells the dev - oh, I better add in the setting |
@Montellese You ok with this to merge in its current state? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't show as fixed, did you push it?
jenkins build this please |
Description
If there is a service add-on running a loop that accesses the addon settings, it can quickly fill up the debug log with essentially non-helpful messages.
"failed to find definition for setting {}. Creating a setting on-the-fly..."
This shows if the add-on has removed a setting but the user still has that setting in their userdata.
They can't do anything about that and neither can the author. So can we stop logging about it?
"CSettingsManager: requested setting ({}) was not found" is still logged when a setting isn't actually in the settings.xml but tried to access via the add-on.
"loading setting values"
Do we need to know this? - it logs if this fails anyway.
"loading setting definitions"
Same as above.
Yes, its only debug messages.
But users use debug log to find issues.
So the less "bloat" of unneeded messages - the easier to find their issue.
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of change
Checklist: