LOG_* macros not working

Hi,

I tried to use the LOG_DEBUG macros in my device server. But they never work as they write for every format specifier just spaces.

Now I tried the tango-test package from debian jessie(stable) and on executing that I get:

1453759720 [140389277255488] INFO tangotest/tt/1 TangoTest::init_device::init device                                                     
                                                                                                                                         
                                                                                                                                         
                                                                                                                                         
                                                                                                                                         
                                                                                                                                         
                                                                                                                                         
                                                                                                                 
Ready to accept request
1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook()  TangoTest/tt/1
1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook()  TangoTest/tt/1
1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook()  TangoTest/tt/1
1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook()  TangoTest/tt/1

And TangoTest does the following:

TangoTest.cpp:  LOG_INFO(("TangoTest::init_device::init device %s", device_name.c_str()));
TangoTest.cpp:  LOG_DEBUG(("In read_attr_hardware for %d attributes",attr_list.size()));
which according to documentation is correct. So I don't seem to do anything particularly wrong.

Do I have to initialize something, somehow? Is that a plain bug? I can of course switch to debug streams but they are less nice to use.

Thanks,
Thomas
I've recompiled log4tango from the tango 8.1.2 distribution using

./configure CPPFLAGS=-DLOG4TANGO_HAVE_SNPRINTF
make
which uses the system vsnprintf instead of the included one and now I get properly formatted output.

1453842671 [139686148966208] INFO tangotest/tt/1 TangoTest::init_device::init device TangoTest/tt/1
1453842671 [139686148966208] DEBUG tangotest/tt/1 sleep_period=2000
1453842671 [139686148966208] DEBUG tangotest/tt/1 mthreaded_impl=0
1453842671 [139686148966208] DEBUG tangotest/tt/1 uShort_image_ro_size=251
Ready to accept request
1453842671 [139685942777600] INFO tangotest/tt/1 TangoTest::always_executed_hook()  TangoTest/tt/1

From [1] I know that vsnprintf is part of C++11.

Conclusion:
The log4tango package in debian has a bug which makes the LOG_ macros useless. This is due to the erroneous default on the builtin vsnprintf code. Builds nowadays should use the available library function vsnprintf.

[1]: http://www.cplusplus.com/reference/cstdio/vsnprintf/
 
Register or login to create to post a reply.