logging in 2.0

Hello,

The RTT changes documents states that "the RTT::Logger class has been
deprecated. Although it is part of this release, you should not rely on
it for future compatibility."

So how is logging to be done now? I saw something related to the log4cpp
library, so I downloaded and cross-compiled it, set BUILD_LOGGING to ON
while doing ccmake in ocl/build directory and indicated the right paths.

The build halts with the following error messages:

---------
[ 80%] Building CXX object
logging/CMakeFiles/orocos-logging-gnulinux.dir/LoggingEvent.cpp.o
/opt/build3/include/log4cpp/threading/PThreads.hh: In constructor
'OCL::logging::LoggingEvent::LoggingEvent(const RTT::rt_string&, const
RTT::rt_string&, const RTT::rt_string&, int)':
/opt/build3/include/log4cpp/threading/PThreads.hh:25: error: too many
arguments to function 'std::string log4cpp::threading::getThreadId()'
/opt/orocos-toolchain-2.0.1/ocl/logging/LoggingEvent.cpp:40: error: at
this point in file
/opt/orocos-toolchain-2.0.1/ocl/logging/LoggingEvent.cpp:40: error: no
match for 'operator=' in
'((OCL::logging::LoggingEvent*)this)->OCL::logging::LoggingEvent::threadName
= log4cpp::threading::getThreadId()()'
/opt/eldk/ppc_6xx/usr/include/c++/4.2.2/bits/basic_string.h:490: note:
candidates are: std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::operator=(const
std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char,
_Traits = std::char_traits<char>, _Alloc = RTT::os::rt_allocator<char>]
/opt/eldk/ppc_6xx/usr/include/c++/4.2.2/bits/basic_string.h:498: note:
std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*)
[with _CharT = char, _Traits = std::char_traits<char>, _Alloc =
RTT::os::rt_allocator<char>]
/opt/eldk/ppc_6xx/usr/include/c++/4.2.2/bits/basic_string.h:509: note:
std::basic_string<_CharT, _Traits, _Alloc>&
std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with
_CharT = char, _Traits = std::char_traits<char>, _Alloc =
RTT::os::rt_allocator<char>]
/opt/orocos-toolchain-2.0.1/ocl/logging/LoggingEvent.cpp: In member
function 'log4cpp::LoggingEvent OCL::logging::LoggingEvent::toLog4cpp()':
/opt/orocos-toolchain-2.0.1/ocl/logging/LoggingEvent.cpp:67: error: no
matching function for call to
'log4cpp::LoggingEvent::LoggingEvent(std::string, std::string,
std::string, int&, std::string, log4cpp::TimeStamp&)'
/opt/build3/include/log4cpp/LoggingEvent.hh:46: note: candidates are:
log4cpp::LoggingEvent::LoggingEvent(const std::string&, const
std::string&, const std::string&, int)
/opt/build3/include/log4cpp/LoggingEvent.hh:32: note:
log4cpp::LoggingEvent::LoggingEvent(const log4cpp::LoggingEvent&)
make[2]: ***
[logging/CMakeFiles/orocos-logging-gnulinux.dir/LoggingEvent.cpp.o] Error 1
make[1]: *** [logging/CMakeFiles/orocos-logging-gnulinux.dir/all] Error 2
make: *** [all] Error 2
--------

Any ideas?

/Sagar

logging in 2.0

On Sep 23, 2010, at 10:02 , Sagar Behere wrote:

> Hello,
>
> The RTT changes documents states that "the RTT::Logger class has been
> deprecated. Although it is part of this release, you should not rely on
> it for future compatibility."
>
> So how is logging to be done now? I saw something related to the log4cpp
> library, so I downloaded and cross-compiled it, set BUILD_LOGGING to ON
> while doing ccmake in ocl/build directory and indicated the right paths.

You can not use the standard log4cpp. We had to modify it to support real-time. See the orocos-toolchain/log4cpp project on gitorious.

Documentation on this is still in progress. In particular, see OCL/bin/deployer.cpp for example of setting up TLSF and log4cpp HierarchyMaintainer to setup the necessary infrastructure. I believe this is in v1 on github, but sure whether is in v2 yet.

S

logging in 2.0

On 09/23/2010 05:14 PM, S Roderick wrote:
>
> On Sep 23, 2010, at 10:02 , Sagar Behere wrote:
>
>> Hello,
>>
>> The RTT changes documents states that "the RTT::Logger class has been
>> deprecated. Although it is part of this release, you should not rely on
>> it for future compatibility."
>>
>> So how is logging to be done now? I saw something related to the log4cpp
>> library, so I downloaded and cross-compiled it, set BUILD_LOGGING to ON
>> while doing ccmake in ocl/build directory and indicated the right paths.
>
> You can not use the standard log4cpp. We had to modify it to support real-time. See the orocos-toolchain/log4cpp project on gitorious.
>
> Documentation on this is still in progress. In particular, see OCL/bin/deployer.cpp for example of setting up TLSF and log4cpp HierarchyMaintainer to setup the necessary infrastructure. I believe this is in v1 on github, but sure whether is in v2 yet.

The OCL/bin/deployer.cpp raised more questions than it answered :(

I understand if the documentation is in progress, but is it possible to
see some code of a simple taskcontext that simple logs "updateHook() was
called." to a file/stdout without doing anything else? That shouldn't
take more than a few minutes to code but will help to get started using
the new logging method.

Thanks in advance,
Sagar

logging in 2.0

On Sep 28, 2010, at 05:09 , Sagar Behere wrote:

> On 09/23/2010 05:14 PM, S Roderick wrote:
>>
>> On Sep 23, 2010, at 10:02 , Sagar Behere wrote:
>>
>>> Hello,
>>>
>>> The RTT changes documents states that "the RTT::Logger class has been
>>> deprecated. Although it is part of this release, you should not rely on
>>> it for future compatibility."
>>>
>>> So how is logging to be done now? I saw something related to the log4cpp
>>> library, so I downloaded and cross-compiled it, set BUILD_LOGGING to ON
>>> while doing ccmake in ocl/build directory and indicated the right paths.
>>
>> You can not use the standard log4cpp. We had to modify it to support real-time. See the orocos-toolchain/log4cpp project on gitorious.
>>
>> Documentation on this is still in progress. In particular, see OCL/bin/deployer.cpp for example of setting up TLSF and log4cpp HierarchyMaintainer to setup the necessary infrastructure. I believe this is in v1 on github, but sure whether is in v2 yet.
>
> The OCL/bin/deployer.cpp raised more questions than it answered :(
>
> I understand if the documentation is in progress, but is it possible to see some code of a simple taskcontext that simple logs "updateHook() was called." to a file/stdout without doing anything else? That shouldn't take more than a few minutes to code but will help to get started using the new logging method.
>
> Thanks in advance,
> Sagar

The documentation is fairly complete at

http://orocos.org/wiki/rtt/rtt-20/real-time-logging/using-real-time-logging

and looks to be up to date. I've attached a sample configuration file. Start a deployer using this as the site file, before you start your application

deployer-gnulinux --site /path/to/setup-logging.xml --start /path/to/myapplication.xml

Create a basic component with

OCL::logging::Category* logger;

as a class member variable, then in configureHook() do

logger =
dynamic_cast<OCL::logging::Category*>(
&log4cpp::Category::getInstance("components.ComponentA"));
// the name above should match something in the setup-logging file
// NB you _must_ use the above method to get the category created by the site file

and in updateHook()

logger->info(OCL::String("updateHook called"));

and look in the "robot.log" file for the output.

I am definitely interested in feedback, so let me know how it goes or if you have more questions.
Stephen

logging in 2.0

Hi,

I am trying to setup logging in my application, and this is my difficulites
:

It's not clear what TLSF is, at least a link to its web description could be
a plus.

It tooks me some time to understand that :

For real-time performance, ensure that TLSF is built with MMAP and SBRK
> support OFF (-DOS_RT_MALLOC_MMAP=OFF -DOS_RT_MALLOC_SBRK=OFF).
>

refers to rtt CMake options.

2010/9/28 Stephen Roderick <kiwi [dot] net [..] ...>

> On Sep 28, 2010, at 05:09 , Sagar Behere wrote:
>
> > On 09/23/2010 05:14 PM, S Roderick wrote:
> >>
> >> On Sep 23, 2010, at 10:02 , Sagar Behere wrote:
> >>
> >>> Hello,
> >>>
> >>> The RTT changes documents states that "the RTT::Logger class has been
> >>> deprecated. Although it is part of this release, you should not rely on
> >>> it for future compatibility."
> >>>
> >>> So how is logging to be done now? I saw something related to the
> log4cpp
> >>> library, so I downloaded and cross-compiled it, set BUILD_LOGGING to ON
> >>> while doing ccmake in ocl/build directory and indicated the right
> paths.
> >>
> >> You can not use the standard log4cpp. We had to modify it to support
> real-time. See the orocos-toolchain/log4cpp project on gitorious.
> >>
> >> Documentation on this is still in progress. In particular, see
> OCL/bin/deployer.cpp for example of setting up TLSF and log4cpp
> HierarchyMaintainer to setup the necessary infrastructure. I believe this is
> in v1 on github, but sure whether is in v2 yet.
> >
> > The OCL/bin/deployer.cpp raised more questions than it answered :(
> >
> > I understand if the documentation is in progress, but is it possible to
> see some code of a simple taskcontext that simple logs "updateHook() was
> called." to a file/stdout without doing anything else? That shouldn't take
> more than a few minutes to code but will help to get started using the new
> logging method.
> >
> > Thanks in advance,
> > Sagar
>
> The documentation is fairly complete at
>
> http://orocos.org/wiki/rtt/rtt-20/real-time-logging/using-real-time-logging
>
> and looks to be up to date. I've attached a sample configuration file.
> Start a deployer using this as the site file, before you start your
> application
>
> deployer-gnulinux --site /path/to/setup-logging.xml --start
> /path/to/myapplication.xml
>
> Create a basic component with
>
> OCL::logging::Category* logger;
>
> as a class member variable, then in configureHook() do
>
> logger =
> dynamic_cast<OCL::logging::Category*>(
>
> &log4cpp::Category::getInstance("components.ComponentA"));
> // the name above should match something in the setup-logging file
> // NB you _must_ use the above method to get the category created by the
> site file
>
> and in updateHook()
>
> logger->info(OCL::String("updateHook called"));
>
> and look in the "robot.log" file for the output.
>
> I am definitely interested in feedback, so let me know how it goes or if
> you have more questions.
> Stephen
>
>
>
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>

logging in 2.0

On Oct 10, 2010, at 10:18 , Willy Lambert wrote:

> Hi,
>
> I am trying to setup logging in my application, and this is my difficulites :
>
> It's not clear what TLSF is, at least a link to its web description could be a plus.

First hit on Google is the original website.

> It tooks me some time to understand that :
>
> For real-time performance, ensure that TLSF is built with MMAP and SBRK support OFF (-DOS_RT_MALLOC_MMAP=OFF -DOS_RT_MALLOC_SBRK=OFF).
>
> refers to rtt CMake options.

I've updated the wiki to indicate that these are RTT CMake options.

Thanks!
S