# How to log

**URL:** <https://forum.indilib.org/t/how-to-log/12355>\
**Category:** Development\
**Created:** [January 17, 2024, 1:14am UTC](https://forum.indilib.org/t/how-to-log/12355 "2024-01-17T01:14:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwannabswiss](https://forum.indilib.org/letter_avatar_proxy/v4/letter/i/7ea924/32.png) [@iwannabswiss](https://forum.indilib.org/u/iwannabswiss)\
**Post date:** [January 17, 2024, 1:14am UTC](https://forum.indilib.org/t/how-to-log/12355/1 "2024-01-17T01:14:38Z")

</div>

I cannot for the life of me figure out what’s going on. I’ve attempted to follow the [Logging in INDI Drivers](https://docs.indilib.org/drivers/logging.html) within the INDI Technical Documentation, which states to call addDebugControl() from within the initProperties(). However, after doing so, when I build the driver and attempt to run, any time I click on Enable Debug, in the INDI message status bar it states Debug is enabled and then immediately Debug is disabled. Now, after searching the forums, it appears logging is handled by Ekos. So does that mean addDebugControl() is no longer needed. When I click on Logs and whether I choose Verbose or Regular and Default or File, I’m not getting log files. Additionally when I was somehow able to create log files, even when set on Verbose, I wasn’t seeing the LOGF\_DEBUG being written to the file.

Can someone please explain what the right steps are? How do I reliably enable logging?

Thanks,  
Nathan

---

<div class="post-metadata">

**Author:** ![knro](https://forum.indilib.org/user_avatar/forum.indilib.org/knro/32/64_2.png) [@knro](https://forum.indilib.org/u/knro)\
**Post date:** [January 17, 2024, 4:21am UTC](https://forum.indilib.org/t/how-to-log/12355/2 "2024-01-17T04:21:09Z")

</div>

You control debugging in Ekos main window → Logs

---

<div class="post-metadata">

**Author:** ![iwannabswiss](https://forum.indilib.org/letter_avatar_proxy/v4/letter/i/7ea924/32.png) [@iwannabswiss](https://forum.indilib.org/u/iwannabswiss)\
**Post date:** [January 17, 2024, 12:22pm UTC](https://forum.indilib.org/t/how-to-log/12355/3 "2024-01-17T12:22:10Z")

</div>

Hi Jasem. Thank you for replying. So to clarify, that means it is no longer necessary to add addDebugControl()?

I’ve discovered the issue though, not sure if you want to make a change.

When I initially start KStars and Ekos, this creates a log folder with the current date and within that, it creates a .txt file with the current time. If I delete the log file and restart Ekos, it creates a new .txt file. However, if I delete the current date folder, it no longer creates log files, nor does it recreate the date folder. You have to close KStars and restart the whole program for it to create a new date folder before logs will start showing back up.

The second log issue I’m having is regarding the actual logging. This is what’s in my code:  
LOG\_DEBUG(“Sending Command and recording with LOG\_DEBUG”);  
LOG\_INFO(“Sending command and recording with LOG\_INFO”);  
LOGF\_DEBUG(“CMD \<%s\>”, command);

Even though I have Verbose logging enabled, only the INFO is being recorded. Here’s the output in my log file:  
[2024-01-17T07:18:20.796 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:21.656 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:21.664 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:22.671 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:22.678 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:23.685 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "  
[2024-01-17T07:18:23.693 EST INFO][org.kde.kstars.indi] - DarkLight Cover/Calibrator : "[INFO] Sending command and recording with LOG\_INFO "

Why is DEBUG not being recorded?

Thanks,  
Nathan

---

<div class="post-metadata">

**Author:** ![knro](https://forum.indilib.org/user_avatar/forum.indilib.org/knro/32/64_2.png) [@knro](https://forum.indilib.org/u/knro)\
**Post date:** [January 17, 2024, 12:56pm UTC](https://forum.indilib.org/t/how-to-log/12355/4 "2024-01-17T12:56:19Z")

</div>

1. addDebugControl() is already called by the base class, so you don’t need to call explicitly.
2. That’s normal, don’t delete folder when KStars is already running 🙂
3. Odd, check driver and check that “Driver Debug” is checked.

 ![Screenshot_20240117_155547.png](https://forum.indilib.org/uploads/default/original/2X/9/9eab079573bba96c99cda0347be5ae21a450b4cb.png)

---

<div class="post-metadata">

**Author:** ![iwannabswiss](https://forum.indilib.org/letter_avatar_proxy/v4/letter/i/7ea924/32.png) [@iwannabswiss](https://forum.indilib.org/u/iwannabswiss)\
**Post date:** [January 18, 2024, 1:22pm UTC](https://forum.indilib.org/t/how-to-log/12355/5 "2024-01-18T13:22:12Z")

</div>

I’m building a driver using the DefaultDevice class and if I don’t include addDebugControl(), I don’t get the options you highlighted. After including it, I was able to get the options and successfully able to get the debug output. Thanks for your help.

Nathan
