v19 Addon Logging Deprecation: NOTICE/SEVERE levels to be deprecated by end of June '20
#1
All,

Recently Kodi 19 moved to using spdlog in its core. This meant a cleanup of the log levels kodi has had for many years. Both the NOTICE and SEVERE levels are now redundant and INFO and FATAL should now be used in their place respectively. Kodi will then use the following set of level for logging: DEBUG, INFO, WARNING, ERROR and FATAL.

Python addons only ever used the xbmc.LOGNOTICE level (SEVERE was never exposed in the API). Work is already underway to update the binary addons starting with PVR. The deprecated log levels have all been changed in Kodi in this PR: https://github.com/xbmc/xbmc/pull/17730.

NOTICE and SEVERE will deprecated from all APIs by the end of June.

As there are some python addons already in the matrix repo using xbmc.LOGNOTICE I will provide list of those on this thread later today.


please note that addons submitted to our repository should only use the xbmc.LOGDEBUG level.
we prefer to keep the standard kodi.log file free from all kinds of addon logging, for two reasons:
- so kodi devs can easily spot kodi issues in the log, without having to scroll through a giant amount of addon logging
- on systems where kodi runs 24/7, the logfile can grow very large very quickly if a lot of logging is done


Regards,

phunkyfish.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#2
Addons/files using this in repo-scripts:

Code:

./script.plex/service.py
./script.plex/lib/util.py
./script.plex/lib/windows/kodigui.py
./script.plex/lib/main.py
./script.plex/lib/kodijsonrpc.py
./script.module.xbmcswift2/lib/xbmcswift2/logger.py
./script.speedfaninfo/resources/lib/spid.py
./script.speedfaninfo/default.py
./script.embuary.helper/resources/lib/helper.py
./script.embuary.info/resources/lib/helper.py
./script.artistslideshow/resources/lib/artistslideshow.py
./script.artistslideshow/default.py
./script.module.web-pdb/libs/web_pdb/logging.py
./script.metadata.editor/resources/lib/helper.py
./service.subtitles.rvm.addic7ed/addic7ed/utils.py
./script.service.next-episode/libs/logger.py
./script.module.addon.signals/lib/AddonSignals.py
./script.xbmc.lcdproc/resources/lib/lcdproc.py
./script.xbmc.lcdproc/resources/lib/common.py
./script.xbmc.lcdproc/resources/lib/lcdbase.py
./script.module.python.twitch/resources/lib/twitch/log.py

Addons/files using this in repo-plugins:

Code:

./plugin.audio.mixcloud/lib/utils.py
./plugin.video.twitch/resources/lib/twitch_addon/service.py
./plugin.video.twitch/resources/lib/twitch_addon/addon/common/log_utils.py
./plugin.video.twitch/resources/lib/twitch_addon/addon/common/url_dispatcher.py
./plugin.video.composite_for_plex/resources/lib/composite_addon/addon/logger.py
./plugin.video.imdb.trailers/resources/lib/imdb_trailers.py
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#3
I've fixed my two and am prepping for submission.  Thanks for letting us know about this.  Out of curiosity, will INFO be logged by default in Kodi 19 instead of NOTICE, or are we down to just WARNING, ERROR, and FATAL if we want to log something to the regular Kodi log file (i.e. without debug logging on in Kodi).  I noticed that in Kodi 18 at least, INFO is only logged when debug logging is one. It's not a huge deal, but I used to use NOTICE just to log that my addon had started and stopped so there was some little note in the log. I changed those to INFO, but obviously in Kodi 18 that now means my addons are completely silent in the log.

Yes, I know I could just change this for Kodi 19, but I'm holding onto the hope that I can keep my code the same for Kodi 18/19 (since I already did all the work to make them Python 2/3 compatible) and just update the addon.xml as needed.
Reply
#4
Yes, that is exactly the change. INFO is the new NOTICE.

So DEBUG+all others in debug mode and only INFO, WARNING, ERROR and FATAL in normal.

You are correct on the impact, INFO would not be seen in Kodi 18.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#5
I checked, LOGNOTICE is still in the Kodi master branch and still works:
https://github.com/xbmc/xbmc/blob/master...g.cpp#L248

Will LOGNOTICE eventually be completely removed in Kodi 19 and when?
Reply
#6
Still works in kodi or from an addon?
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#7
From an addon. With this Python source code:
python:

    xbmc.log(msg='Test 1 DEBUG', level=xbmc.LOGDEBUG)
    xbmc.log(msg='Test 2 INFO', level=xbmc.LOGINFO)
    xbmc.log(msg='Test 3 NOTICE', level=xbmc.LOGNOTICE)
    xbmc.log(msg='Test 4 WARNING', level=xbmc.LOGWARNING)
    xbmc.log(msg='Test 5 ERROR', level=xbmc.LOGERROR)
    xbmc.log(msg='Test 6 SEVERE', level=xbmc.LOGSEVERE)
    xbmc.log(msg='Test 7 FATAL', level=xbmc.LOGFATAL)

I get this output in kodi.log with Kodi 19.0-ALPHA1 (18.9.701) Git:20200823-172b25d561:

html:

2020-08-24 19:47:48.233 T:15893    INFO <general>: Test 2 INFO
2020-08-24 19:47:48.233 T:15893    INFO <general>: Test 3 NOTICE
2020-08-24 19:47:48.233 T:15893 WARNING <general>: Test 4 WARNING
2020-08-24 19:47:48.233 T:15893   ERROR <general>: Test 5 ERROR
2020-08-24 19:47:48.233 T:15893   FATAL <general>: Test 6 SEVERE
2020-08-24 19:47:48.233 T:15893   FATAL <general>: Test 7 FATAL
Reply
#8
Let me schedule this change and we'll get it in for Alpha2. Apologies, it should have been in for the first Alpha.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#9
Here is the PR pertaining to removal: https://github.com/xbmc/xbmc/pull/18346

I have included the a list of the add-ons using LOGNOTICE and LOGSEVERE from both the repo-scirpts and repo-plugins matrix branches.

Anywhere else I should look @mediaminister @pkscout ?

EDIT: I plan to merge this in 2 weeks time.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#10
@phunkyfish I think between what you listed here and the addition of the scrapers mentioned in the PR that we're fine in terms of where to look.
Reply
#11
Great, thanks!
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#12
Okay, I get AttributeError in add-ons when using xbmc.LOGNOTICE and xbmc.LOGSEVERE with PR 18346 in Kodi 19. It's really removed now.
Reply
#13
(2020-08-30, 16:51)mediaminister Wrote: Okay, I get AttributeError in add-ons when using xbmc.LOGNOTICE and xbmc.LOGSEVERE with PR 18346 in Kodi 19. It's really removed now.

Thanks for checking. I will merge the PR in about 2 weeks time.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#14
This PR has been merged.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#15
@phunkyfish 
Can you please do a similar exercise for xbmcvfs.translatePath() move as well.
There are a few scripts still using xbmc.translatePath() in the matrix repo (for e.g. script.kodi.windows.update\default.py) which use this and is raising Deprecation messages in the log
Code:
WARNING <general>: xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.
Kodi 21RC2 Windows 10 and 11 | 21RC2 Xbox One X | 21RC2 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply

Logout Mark Read Team Forum Stats Members Help
Addon Logging Deprecation: NOTICE/SEVERE levels to be deprecated by end of June '200