Squeezebox Controller Messages File
From SqueezeboxWiki
There are system log messages stored in a file on the Squeezebox Controller. These are often useful for debugging things.
Contents |
Sample code
122539:3718 INFO (NetworkThread.lua:249) - NOTIFY: serverDisconnected(SlimServer {DaddyMac-313.local}, 1) 122539:3718 INFO (SlimDiscoveryApplet.lua:422) - serverDisconnected SlimServer {DaddyMac-313.local} 122539:3718 INFO (SlimBrowserApplet.lua:533) - _connectingToPlayer popup show 122539:3719 INFO (AppletManager.lua:235) - Registering: SetupDateTime 122539:3719 INFO (AppletManager.lua:235) - Registering: SelectPlayer 122539:3733 INFO (AppletManager.lua:235) - Registering: SetupWallpaper 122539:3742 INFO (AppletManager.lua:445) - Loaded: SetupWallpaper 122539:3742 INFO (SetupWallpaperApplet.lua:361) - SetupWallpaper, setting wallpaper for wallpaper 122539:3752 INFO (AppletManager.lua:586) - Freeing: SetupWallpaper 122539:3753 INFO (AppletManager.lua:445) - Loaded: SetupWallpaper 122539:3753 INFO (AppletManager.lua:445) - Loaded: SelectPlayer 122539:3753 INFO (AppletManager.lua:235) - Registering: SetupSqueezebox 122539:3753 INFO (AppletManager.lua:235) - Registering: DesktopJive 122539:3753 INFO (AppletManager.lua:235) - Registering: SetupAppletInstaller 122539:3753 INFO (AppletManager.lua:235) - Registering: LogSettings 122539:3753 INFO (AppletManager.lua:235) - Registering: InfoBrowser 122539:3754 INFO (AppletManager.lua:235) - Registering: BlankScreen
Within an applet, if you load in the log methods
local log = require('jive.utils.log').logger("applets.misc")
Where applets.misc is a category for logging described in jive.utils.log (aka jive/utils/log.lua, or full path on a running controller /usr/share/jive/jive/utils/log.lua)
Then anywhere in your code where you want a log message to print to the messages file, you call a logging method like so:
log:warn('This is a warning')
Where "warn" is a logging level. Supported logging levels are debug, info, warn, and error. The log level for a given category is described at jive.utils.log, and can be changed by either editing that file, or (if an SD card is present in the controller), by navigating to Settings->Advanced->Logging
Viewing Additions to the Messages File on a Controller in Real-Time
- Enable ssh by navigating to Settings->Advanced->Remote Login. After checking the checkbox for enabling remote login, there will be a help message that tells you the IP address of the controller. Note this address.
- SSH into the machine using an SSH client (on Linux or OS X, just open a terminal and type `ssh root@<ip address of controller noted in previous step>`, on Windows putty.exe is a good client to use, or use cygwin)
- default password of controller is `1234`
- use the tail command with the -f flag to view the message file as it is written. From the tail man page:
-f The -f option causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. The -f option is ignored if the standard input is a pipe, but not if it is a FIFO.
- messages file is typically at either /var/log/messages, or if you have an SD card inserted that has a log subdirectory, /mnt/mmc/log/messages
tail -f /var/log/messages
Extracting the Messages File from a Controller
Getting the messages file off the controller is not difficult, and there are two typical ways of doing it.
SD card
Create a top-level directory called "log" on an SD card, then insert it into the controller. The log file will then be written to the SD card at /media/.../log/messages, and can be browsed to when mounting the SD card back to a PC.
SCPing the file
Enable remote login as described in a section of this page above, then use scp (aka secure copy) to copy the file over ssh to your local PC. Again, on Linux and OS X, command-line scp will work fine:
scp root@<your controller ip address>:/var/log/messages /some/local/path/messages
On Windows, try Cygwin or Filezilla for your SCPing needs.