Logging custom uORB topics px4 simulation (SITL)

I have created a custom uORB topic, that publishes GPS data (custom). The uORB topic name is gps_fake, and I have verified that the messages are being published by typing the uORB topic name in the px4 console (pxh> gps_fake). I wanted the logger to log data from this topic as well, so I added only the relavant topic names in the logger_topics.txt file present in the PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging folder, as suggested here.
The logger_topics.txt file contains the following uORB topics:

sensor_combined
vehicle_air_data
vehicle_magnetometer
vehicle_gps_position
actuator_controls
actuator_outputs
gps_fake

However, when I run the simulation successfully, and try to download the log files from the QGroundControl software, all the default topics are only logged. The topic gps_fake is not logged at all.

Can someone please help me with this?

Thanks in advance.

I was able to figure out the issue, I am just posting it so that someone else could benefit from this. Note that I am using SITL with gazebo, and not any hardware.

I figured out that the logs were stored in ~./ros/log/<yyyy-mm-dd>/, (specifically it was ~./ros/log/2021-04-31/ as I ran the simulation on this day) which is very different than the directory rootfs/fs/microsd/log/ which was mentioned in the documentation. I an not very sure why this was the case, but the solution worked for me. Further, in the official logger documentation, the rootfs directory is asked to be put inside the directory PX4-Autopilot/build/px4_sitl_default/tmp/.

But when I put the logger_topics.txt in the directory PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging/, the logger just recorded all the default topics (my custom uORB topic wasn’t included). However, considering where the logs were stored, I put the logger_topics.txt file inside ~/.ros/etc/logging folder, and it is working perfectly now. The logger records only the topics mentioned in the file. Thus in my case, the entire PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/ path was getting mapped to ~./ros/ folder for SITL.

I don’t know why this was the situation, but it finally worked.

Hope this helps.

I’m having the same issue.

Specifying the list of topics in the following file doesn’t override the default list of logged topics:
PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/fs/microsd/etc/logging/logger_topics.txt

I tried to use Jarvis’s solution, but I can’t find any ~/.ros or ~./ros directory

So, where does logger_topics.txt really need to go (for SITL)?

Specifically, I’m running it with the following command:
make px4_sitl_default gazebo-classic_plane

I ended up with a slightly different solution (perhaps because of changes made to the system since Jarvis reported his solution in April 2021):

I put the custom list of topics in:
/PX4-Autopilot/build/px4_sitl_default/rootfs/etc/logging/logger_topics.txt

The logs went to subdirectories created under the following location:
/PX4-Autopilot/build/px4_sitl_default/rootfs/log