BehaviorTree/BehaviorTree.CPP

MinitraceLogger doesn't log or create despite being enabled

Closed this issue · 1 comments

When creating a MinitraceLogger, a log file is not created and nothing is logged. It shows enabled, but because the MTR_ENABLED macro is now not defined in the minitrace.h header it does not do anything. BehaviorTree.CPP is installed from binaries on the latest version, using humble.

How to reproduce:
Create a minitrace logger, and add it to any tree. this is the btcpp_sample.cpp

#include "behaviortree_cpp/loggers/bt_minitrace_logger.h"
...
BT::MinitraceLogger minitrace_logger(tree, "bt_trace.json");

This should create the specified log file and write to it. Building from source or using binaries does not produce different results.

minitrace.cpp was updated to include MTR_ENABLED and it was commented from minitrace.h here 93c661c. Minitrace README was also updated https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/3rdparty/minitrace/README.md to specify how MTR_ENABLED must be defined in the minitrace.h header file or globally. Adding MTR_ENABLED to bt_minitrace_logger.cpp then including minitrace.h works for the header file, but it doesn't make its way to the minitrace.cpp functions(https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/src/loggers/bt_minitrace_logger.cpp#L4).

When building with either the compile flag -DMTR_ENABLED or uncommenting #define MTR_ENABLED from minitrace.h the logger works as expected. This does not seem intentional as MTR_ENABLED was moved to the bt_minitrace_logger.cpp source file and the README updated.

solved!