Version: 1.1
Last Updated: 2026-01-26
This guide covers the logging system in EasyTV for both users and developers.
- Go to Settings → Advanced → Debugging
- Enable "Enable debug logging"
- Reproduce the issue you're troubleshooting
- Find the log file at:
special://profile/addon_data/script.easytv/logs/easytv.log
The debug log is stored separately from Kodi's main log:
| Platform | Typical Path |
|---|---|
| Windows | %APPDATA%\Kodi\userdata\addon_data\script.easytv\logs\easytv.log |
| Linux | ~/.kodi/userdata/addon_data/script.easytv/logs/easytv.log |
| macOS | ~/Library/Application Support/Kodi/userdata/addon_data/script.easytv/logs/easytv.log |
| LibreELEC | /storage/.kodi/userdata/addon_data/script.easytv/logs/easytv.log |
- Maximum file size: 500KB
- Rotated files:
easytv.1.log,easytv.2.log,easytv.3.log - Older files are automatically deleted when rotated
| Log Level | When Debug OFF | When Debug ON |
|---|---|---|
| ERROR | Kodi log only | Kodi log + easytv.log |
| WARNING | Kodi log only | Kodi log + easytv.log |
| INFO | Kodi log only | Kodi log + easytv.log |
| DEBUG | Not logged | easytv.log only |
This design keeps Kodi's log clean while giving you detailed debug information in a separate file.
EasyTV uses a custom StructuredLogger class that provides:
- Dual output — INFO/WARNING/ERROR go to Kodi log; DEBUG goes to file only
- Structured logging — Key-value pairs for machine-readable context
- Event naming — Consistent
domain.actionevent taxonomy - Thread safety — All file operations are lock-protected
- Automatic rotation — Files rotate at 500KB
from resources.lib.utils import get_logger
log = get_logger('module_name')Logger names by package:
| Package | Logger Name |
|---|---|
service/ |
'daemon' or 'service' |
ui/ |
'ui', 'wizard' |
data/ |
'data', 'shareddb', 'storage' |
playback/ |
'playback' |
| Entry points | 'default', 'clone', 'selector', 'export', 'clear_sync' |
Use when an operation cannot complete. Always include event= with .fail suffix.
log.error("Playlist write failed",
event="playlist.fail",
playlist=name, show=showname)For exceptions, use log.exception() to auto-capture stack trace:
try:
risky_operation()
except Exception:
log.exception("Operation failed", event="operation.fail", id=123)Use for fallback paths, missing data that's recovered, or unusual conditions.
log.warning("Episode not in expected list",
event="playback.fallback",
show_id=show_id, episode_id=ep_id)Use for lifecycle events and user-visible actions. These appear in Kodi's log.
log.info("Service started", event="service.start", version="4.0.9")
log.info("Playlist created", event="playlist.create", item_count=10)Use freely for troubleshooting. Never appears in Kodi's log.
log.debug("Processing shows", count=47)
log.debug("Episode found in ondeck list", position=3)Events follow the pattern: domain.action
| Domain | Used For | Example Events |
|---|---|---|
service |
Service lifecycle | service.start, service.stop, service.init |
settings |
Configuration | settings.load, settings.migrate, settings.id_shift, settings.validation_complete, settings.orphan_cleanup, settings.sync_toggle |
library |
Kodi library | library.refresh, library.fallback |
playback |
Video playback | playback.start, playback.fallback |
playlist |
Playlist operations | playlist.create, playlist.start, playlist.fail |
next |
Next episode logic | next.pick, next.fallback |
clone |
Clone operations | clone.create, clone.update, clone.fail |
export |
Episode export | export.start, export.complete, export.fail |
ui |
User interface | ui.open, ui.select, ui.surprise, ui.fallback |
selector |
Show selector, guided-question genre preset picker | selector.save, selector.crash, selector.genres_open, selector.genres_save |
shareddb |
Shared DB sync | shareddb.connect, shareddb.backoff, shareddb.write |
storage |
Storage abstraction | storage.init_local, storage.init_shared, storage.reset |
sync |
Multi-instance sync | sync.added, sync.daemon_check, sync.clear_requested |
wizard |
Guided flow (logger 'wizard') |
wizard.start, wizard.step, wizard.complete, wizard.cancel |
filter |
Guided flow candidate filtering (filter.step/filter.apply always logger 'data'; filter.base_set logs under the caller's logger) |
filter.base_set, filter.step, filter.apply |
Add INFO logging for:
- Service/addon lifecycle events (start, stop, shutdown)
- User-initiated actions that complete successfully
- Configuration changes
Add WARNING logging for:
- Fallback paths taken (missing data, using defaults)
- Recoverable errors
- Unexpected but handled conditions
Add ERROR logging for:
- Operations that fail and cannot be recovered
- File I/O failures
- Critical missing dependencies
Add DEBUG logging for:
- Function entry with key parameters
- Loop iterations and counts
- Algorithm decisions
- Data transformations
- Timing information
Use log_timing() for expensive operations:
from resources.lib.utils import get_logger, log_timing
log = get_logger('daemon')
with log_timing(log, "retrieve_show_ids"):
result = json_query(get_unwatched_shows_query(), True)This logs operation start and duration at DEBUG level.
For operations with multiple phases, use the timer.mark() method:
with log_timing(log, "bulk_refresh", show_count=277) as timer:
# Phase 1: Query shows
result = json_query(get_shows_by_lastplayed_query(), True)
timer.mark("show_query")
# Phase 2: Query episodes
episodes = json_query(build_all_episodes_query(), True)
timer.mark("episode_query")
# Phase 3: Process data
process_episodes(episodes)
timer.mark("processing")
# Logs: bulk_refresh completed | duration_ms=1500, show_count=277,
# show_query_ms=50, episode_query_ms=800, processing_ms=650The following timing events are defined in the daemon module:
| Event | Description | Phases |
|---|---|---|
bulk_refresh |
Startup/rescan with all shows | show_query_ms, episode_query_ms, processing_ms, playlists_ms |
show_refresh |
Single show refresh (playback tracking) | show_query_ms, episode_query_ms, processing_ms |
retrieve_show_ids |
Fetching show IDs from library | (no phases) |
Example bulk_refresh output:
bulk_refresh completed | duration_ms=1500, show_count=277,
show_query_ms=50, episode_query_ms=800, processing_ms=600, playlists_ms=50
Example show_refresh output:
show_refresh completed | duration_ms=45, show_count=1,
show_query_ms=10, episode_query_ms=20, processing_ms=15
Every module with logging should include a Logging section:
"""
Module description here.
Logging:
Logger: 'module_name'
Key events:
- domain.action (LEVEL): Description
- domain.other (LEVEL): Description
See LOGGING.md for full guidelines.
"""❌ Don't log sensitive data:
# BAD
log.debug("User credentials", password=user_password)❌ Don't use print():
# BAD
print("Debug info")
# GOOD
log.debug("Debug info")❌ Don't forget event= for INFO/WARNING/ERROR:
# BAD - missing event
log.info("Service started")
# GOOD
log.info("Service started", event="service.start")❌ Don't use error() in except blocks:
# BAD - loses stack trace
except Exception as e:
log.error("Failed", error=str(e))
# GOOD - captures full trace
except Exception:
log.exception("Failed", event="operation.fail")❌ Don't log in tight loops without throttling:
# BAD - floods log
for item in thousands_of_items:
log.debug("Processing", item=item)
# GOOD - log summary
log.debug("Processing items", count=len(items))
for item in items:
process(item)
log.debug("Processing complete")[EasyTV.module] message | event=domain.action, key=value, ...
2025-01-15 14:45:12.401 [INFO ] [EasyTV.module] message | event=domain.action, key=value
2025-01-15 14:45:12.402 [DEBUG] [EasyTV.module] developer details | count=47
The multi-instance sync feature introduces several new logging domains for tracking database synchronization across Kodi devices.
Database connection and operations.
| Event | Level | Description |
|---|---|---|
shareddb.connect |
INFO | Connected to MySQL/MariaDB |
shareddb.reconnect |
INFO | Connection recovered after disconnect |
shareddb.backoff |
WARNING | Connection failed, backing off 30s |
shareddb.backoff_active |
WARNING | Still in backoff period |
shareddb.config_found |
DEBUG | Found advancedsettings.xml |
shareddb.config_error |
WARNING | Failed to parse advancedsettings.xml |
shareddb.no_video_db |
WARNING | Kodi video database not found |
shareddb.found_video_db |
DEBUG | Located Kodi video database |
shareddb.init_separate |
INFO | Using dedicated easytv database |
shareddb.init_fallback |
INFO | Using Kodi DB (CREATE DATABASE denied) |
shareddb.init_prefixed |
INFO | Using prefixed tables in Kodi DB |
shareddb.schema_migrate |
INFO | Schema migration applied |
shareddb.migration_claimed |
INFO | Migration lock acquired |
shareddb.migration_lock_stolen |
WARNING | Stale lock stolen (crashed instance) |
shareddb.migration_skipped |
INFO | Another instance is migrating |
shareddb.migration_complete |
INFO | Migration lock released |
shareddb.id_recovered |
INFO | Show ID recovered via title+year |
shareddb.orphans_deleted |
INFO | Orphaned shows cleaned up |
shareddb.validate_complete |
INFO | ID validation completed |
shareddb.clear |
INFO | All sync data cleared |
shareddb.clear_error |
ERROR | Failed to clear sync data |
Storage abstraction layer.
| Event | Level | Description |
|---|---|---|
storage.init_local |
INFO | Using window property storage |
storage.init_shared |
INFO | Using shared database storage |
storage.pymysql_missing |
WARNING | pymysql not installed, falling back |
storage.clear_stale |
DEBUG | Cleared props for show deleted elsewhere |
storage.reset |
INFO | Storage singleton reset |
storage.refresh_show |
DEBUG | Per-show sync refresh branch (see below) |
storage.refresh_summary |
DEBUG | Branch counts for one bounded refresh |
storage.resume_refresh_failed |
WARNING | Resume query failed, stale progress kept |
get_ondeck_bulk(refresh_display=True) decides per show whether to query
Kodi. That decision is what determines whether a peer picks up a resume
point, so it is logged as a branch field:
| Branch | Meaning |
|---|---|
skipped_synced |
SyncedAt == updated_at, treated as already current, no Kodi call |
first_encounter |
No marker yet but props already match the DB on-deck, marker seeded, no Kodi call |
display_refresh |
On-deck changed elsewhere, full episode refresh from Kodi |
resume_refresh |
Same episode, row changed, resume and percentage re-read from Kodi |
refresh_failed |
A Kodi query failed, previous properties kept |
Only the refreshing branches emit a per-show storage.refresh_show line;
the two no-op branches appear as counts in storage.refresh_summary, so a
200-show browse stays at one line. A show that repeatedly reports
skipped_synced while its progress looks stale means updated_at is not
advancing on the writing instance.
Multi-instance show synchronization and data management.
Clone/browse sync (Logger: 'data'):
| Event | Level | Description |
|---|---|---|
sync.added |
INFO | Shows discovered from shared DB by clone/browse |
sync.removed |
INFO | Shows removed per shared DB by clone/browse |
sync.add_error |
ERROR | Failed to fetch added show data |
sync.error |
ERROR | Show list sync failed |
Daemon periodic sync (Logger: 'daemon'):
| Event | Level | Description |
|---|---|---|
sync.daemon_check |
DEBUG | Shared DB revision changed, reconciling |
sync.daemon_unchanged |
DEBUG | Shared DB revision unchanged, no action |
sync.daemon_added |
INFO | Shows added to daemon from shared DB |
sync.daemon_removed |
INFO | Shows removed from daemon per shared DB |
sync.daemon_consumed |
INFO | Shows pulled from the shared DB for refresh (intent, not outcome: see storage.refresh_summary for what was actually re-read) |
sync.daemon_consume_noop |
DEBUG | Consumed shows that were already current, re-categorisation skipped |
sync.daemon_skip_playback |
DEBUG | Periodic sync skipped (playback active) |
sync.daemon_error |
ERROR | Failed to fetch tracked show IDs |
sync.pending_processed |
DEBUG | Processed pending shows flagged by clone |
Clear sync data (Logger: 'clear_sync'):
| Event | Level | Description |
|---|---|---|
sync.clear_requested |
INFO | User initiated clear operation |
sync.clear_success |
INFO | Data cleared successfully |
sync.clear_failed |
WARNING | Clear operation failed |
sync.clear_cancelled |
INFO | User cancelled clear dialog |
The following operations are instrumented with log_timing:
| Operation | Logger | Description |
|---|---|---|
shareddb.schema_init |
shareddb | Database schema creation |
shareddb.write |
shareddb | Show tracking write |
shareddb.bulk_read |
shareddb | Bulk show data fetch |
shareddb.validate_ids |
shareddb | ID validation after rebuild |
shareddb.migration_claim |
shareddb | Migration lock acquisition |
The guided flow (Settings → EasyTV → Guided questions) asks up to six mood questions before Browse Mode or Random Playlist Mode and narrows the candidate shows accordingly. See docs/guided-questions.md for user-facing behavior.
| Event | Level | Description |
|---|---|---|
wizard.start |
INFO | Guided flow started; logs the enabled steps and candidate count |
wizard.step |
DEBUG | User answered one question |
wizard.cancel |
INFO | User cancelled the flow (from a question, or from the zero-result "Adjust answers" prompt) |
wizard.complete |
INFO | Flow completed; logs result and candidate counts |
wizard.empty_base |
INFO | The pre-wizard candidate set (population, episode selection, premieres already applied) was already empty; the flow returns immediately with no matches |
wizard.not_applicable (logger 'default', in ui/main.py main_entry) |
DEBUG | Guided flow skipped because the launch is a movies-only playlist |
wizard.save_fail (logger 'storage', in data/storage.py) |
WARNING | Remembered answers could not be written to wizard_answers.json |
| Event | Level | Description |
|---|---|---|
filter.base_set |
DEBUG | Base candidate show ids resolved from population, episode selection, and premiere settings, before any guided question is applied. Logs under whatever logger the caller supplied to resolve_candidate_show_ids, not a fixed logger name; currently that's 'default', since the guided flow (its only caller) always passes the UI entry point's logger |
filter.step |
DEBUG | One mood filter (genre, duration, year, rating, depth) applied; logs the remaining count. Only logged for the final filter pass, not the per-question cumulative counts. Always logger 'data' (apply_show_filters uses the module's own logger, not a caller-supplied one) |
filter.apply |
DEBUG | All configured mood filters applied to a show list; logs input and result counts. Always logger 'data', same as filter.step |
browse.inprogress_error (WARNING) is the shared in-progress lookup (fetch_inprogress_episode_ids) used by the premiere filter; the guided flow's filter.base_set resolution, Browse Mode, and the random playlist builder all route through this one function and share this one event name, but each passes its own caller-supplied logger through rather than a fixed 'data' logger. Currently that resolves to 'default' from the guided flow and from an interactive Browse Mode or Random Playlist launch (both go through main.py's UI entry point), and to 'daemon' when the random playlist builder is invoked from the background service's playlist-continuation regeneration path (service/daemon.py).
Font-substitution workaround for the Estuary-only skin font bug (kodi#28534); generates a per-skin adapted dialog XML on demand.
| Event | Level | Description |
|---|---|---|
skinfont.generate |
INFO | Generated adapted dialog XML for a skin |
skinfont.fallback |
WARNING | Generation unavailable, using shipped path |
skinfont.error |
ERROR | Unexpected font generation error, using shipped path |
skinfont.bad_id |
WARNING | Rejected invalid addon_id |
skinfont.skip |
DEBUG | Skin Font.xml unreadable or oversized, using shipped path |
json_query replaces invalid UTF-8 in JSON-RPC results with U+FFFD before any caller sees it, because handing a lone surrogate back to a Kodi string API crashes Kodi. These events point at the library item that holds the bad text.
| Event | Level | Description |
|---|---|---|
jsonrpc.invalid_utf8 |
DEBUG | A string in the result held invalid UTF-8 and was replaced. Fields: method, field (path within the result), the enclosing item's integer *id fields (such as episodeid, tvshowid), and item (its title or label). Emitted only when a replacement happened and debug logging is on |
- Check that debug logging is enabled in settings
- Verify the addon_data directory exists and is writable
- Check Kodi's log for initialization errors
The file auto-rotates at 500KB. If you're generating logs faster than expected, check for:
- Tight loops with logging
- Repeated operations that should be batched
- DEBUG logs only appear when debug logging is enabled
- Check you're looking at the right file (easytv.log vs kodi.log)
- Verify the logger name matches what you expect
For more information, see the EasyTV README and source code.