TL;DR: Try journalctl -r _COMM=vlc
for the default modern systemd based Linux distros (Ubuntu 15.04+), which includes jounrald as a common logging sink for processes logging via stdout, including VLC.
Many answers above are useful and informative, @Zoltán had an answer that works for VLC installed via snap (sudo snap install vlc
):
VLC will be logging to /var/log/syslog
However, the better more modern way would be to use journalctl filtered to the vlc command, e.g. last 10 lines:
journalctl -r _COMM=vlc --lines 10 --no-pager
The following old way searching syslog works well enough, given rsyslogd reads journald and logs to /var/log/syslog by default:
grep vlc /var/log/syslog | tail
The above two options worked by default (for VLC snap 3.0.8 and Ubuntu 18.04.4 LTS) given the vlc process logs to stdout and I assume journald captures stdout. So both of the following, as per default, can remain unchecked:
- Advanced -> Logger -> Log to file
- Advanced -> syslog -> System log (syslog)
However, if you execute vlc directly from a terminal instead of gnome (or alternate) desktop launcher, then stdout and stderr IO streams would go to the terminal console instead of journald. In such a case, enabling either of the two explicit logging options might be appropriate.
Logging to a file can be tricky if the app is installed as a snap, since snaps have a stricter security model and might block creating a log file in arbitrary directories.
If a dedicated log file is desired, either log to a location the snap is allowed to write to (see snap connections vlc
, where I noticed locations such as your home dir can be written to). Writing directly to somewhere in /var/log probably won't be allowed.
By default (in Ubuntu 18.04), journald doesn't persist events across reboots, but syslog does. One can explicitly enable journald events to persist if so desired.
VLC logging to file directly doesn't seem to put timestamps into the direct log file while journald and syslog include timestamps for when the event was generated.
Until the Linux community is fully ready to adopt journald (with persistence) instead of syslog, they coexist, so the legacy *nix way of handling this would be to configure rsyslog to redirect VLC logs into a separate log location. E.g. create the dir with appropriate permissions:
sudo mkdir /var/log/vlc
sudo chown syslog:adm /var/log/vlc
sudo chmod ug+rwX,o-rwx /var/log/vlc/
Add a config file to rsyslog, e.g. at /etc/rsyslog.d/30-vlc.conf
:
# filter out and move various VLC snap messages to it's own log file
if ($programname == 'vlc' or $programname == 'vlc_vlc.desktop') then
{
action
( name="cntlm_log_file"
type="omfile"
file="/var/log/vlc/vlc.log"
fileCreateMode="0640"
fileOwner="syslog"
fileGroup="adm"
)
# don't log events to the system's default syslog file
stop
}
Restart the service: sudo systemctl restart rsyslog
Also be sure to setup logrotate as well, e.g. to rotate weekly and keep 12 weeks, create a file /etc/logrotate.d/vlc
as follows:
/var/log/vlc/*.log
{
rotate 12
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
invoke-rc.d rsyslog rotate >/dev/null 2>&1 || true
endscript
}
Happy logging...