6

I am actually trying to figure out where the DBG("") prints are going when I do a music stream using bluez to my headset. So basically I want to know where all the bluez debug messages are getting printed, be it any kind of bluetooth operation. ex: scan, inquiry , connect and so on .

Hopefully someone can help me with this . Thanks in advance .

Sagar Sm
  • 69
  • 1
  • 1
  • 2
  • It's not clear which `DBG` calls you mean (the kernel? the bluetoothd daemon? the bluetooth client?). But in general kernel messages can be viewed with `dmesg` and many applications (including bluetoothd) log into syslog which is a file that can be viewed usually as `/var/log/syslog`. – kaylum May 04 '16 at 23:11
  • 1
    The bluetooth daemon logs is what I mean . There are many DBG(" ") prints inside bluez/profiles/audio in many of the .c files, So my assumption is there may be a file where all these DBG(" ") lines get documented when I do any operation involving A2DP, so that I can know which functions get called and which .c files are getting used during a specific operation. So I just want to know how to enable those. I tried /var/log/syslog but those will have logs only if there are any major changes involving bluetooth . Thanks in advance . – Sagar Sm May 05 '16 at 09:30

2 Answers2

11

I have no Ubuntu here at the moment, but this is the way it works on Fedora and I'm sure it is very similar on Ubuntu, especially the systemd-part:

enable debugging by adding a -d after

ExecStart=/usr/libexec/bluetooth/bluetoothd

in /usr/lib/systemd/system/bluetooth.service

Save, then:

$ systemctl daemon-reload
$ systemctl restart bluetooth

Now you get your information in /var/log/syslog

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
heidelbeere
  • 157
  • 1
  • 12
10

To add to datafridge's answer above, I didn't have /usr/lib/systemd/system/bluetooth.service in Ubuntu 16.04 with BlueZ 5.41.

The file was at /etc/systemd/system/bluetooth.target.wants/bluetooth.service and the entry to be modified was

ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd –d

The logs can also be seen using

journalctl --unit=bluetooth -f
unni
  • 183
  • 2
  • 9