[Bug 538] New: Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

           Summary: Unable specify log level when starting deployer
           Product: OCL
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Deployment
        AssignedTo: orocos-dev at lists [dot] mech [dot] kuleuven [dot] be
        ReportedBy: kiwi.net at mac [dot] com
                CC: orocos-dev at lists [dot] mech [dot] kuleuven [dot] be
   Estimated Hours: 0.0

Want to be able to specify the log level of the deployer application at startup
e.g.

deployer-gnulinux --log=DEBUG

or

deployer-gnulinux --log=Info

etc.

Would anyone be against using the boost::program_options library to do this?
Replacing the existing commandi line parsing would be trivial with this library
also.

Cheers
S


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

Peter Soetens <peter.soetens at fmtc [dot] be> changed:

           What    |Removed                     |Added
 --------------------------------------------------------------------------
                 CC|                            |peter.soetens@fmtc.be
--- Comment #1 from Peter Soetens <peter.soetens at fmtc [dot] be>  2008-05-05 21:48:42 ---

(In reply to comment #0)
> Want to be able to specify the log level of the deployer application at startup
> e.g.
>
> deployer-gnulinux --log=DEBUG
>
> or
>
> deployer-gnulinux --log=Info

Just do:

export ORO_LOGLEVEL=6
or
export ORO_LOGLEVEL=5

deployer-gnulinux

>
> Would anyone be against using the boost::program_options library to do this?
> Replacing the existing commandi line parsing would be trivial with this library
> also.

You're free to add this and it will be accepted, but it is in a way redundant.

Peter


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

S Roderick <kiwi.net at mac [dot] com> changed:

           What    |Removed                     |Added
 --------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |1.6.0
--- Comment #2 from S Roderick <kiwi.net at mac [dot] com>  2008-05-06 13:53:26 ---

> > Would anyone be against using the boost::program_options library to do this?
> > Replacing the existing commandi line parsing would be trivial with this library
> > also.
>
> You're free to add this and it will be accepted, but it is in a way redundant.

I will go ahead and do this. We'd like to have a way, redundant though it is,
to specify the log level from command line and not have to manipulate the
environment.


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #3 from S Roderick <kiwi.net at mac [dot] com>  2008-05-06 14:34:38 ---

Created an attachment (id=274)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=274)

Proposed patch using boost::program_options

Patch for ocl/bin files


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #4 from S Roderick <kiwi.net at mac [dot] com>  2008-05-06 15:29:13 ---

(In reply to comment #3)
> Created an attachment (id=274)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=274) [details]

> Proposed patch using boost::program_options
>
> Patch for ocl/bin files
>

I just realised that I accidentally changed the config file option name. Line
23 of deployer.cpp should read

("start",

instead of

("config-file",

Sorry
S


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #5 from Peter Soetens <peter.soetens at fmtc [dot] be>  2008-05-06 17:08:03 ---

(In reply to comment #3)
> Created an attachment (id=274)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=274) [details]

> Proposed patch using boost::program_options
>
> Patch for ocl/bin files
>

We'll have to modify the config/* cmake files as well to detect that the user
has installed the boost::program_options library and headers.
The cause of this report, adding --log=Info is not yet in this patch...


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #6 from Peter Soetens <peter.soetens at fmtc [dot] be>  2008-05-06 17:15:32 ---

Created an attachment (id=275)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=275)

Halts cmake if boost::program_options was not found


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #7 from S Roderick <kiwi.net at mac [dot] com>  2008-05-06 17:31:49 ---

(In reply to comment #6)
> Created an attachment (id=275)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=275) [details]

> Halts cmake if boost::program_options was not found

Understood. I've finished the code for this patch, and will take a look at the
cmake problem later today.
S


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

S Roderick <kiwi.net at mac [dot] com> changed:

           What    |Removed                     |Added
 --------------------------------------------------------------------------
 Attachment #274 is|0                           |1
           obsolete|                            |
--- Comment #8 from S Roderick <kiwi.net at mac [dot] com>  2008-05-08 21:30:07 ---

Created an attachment (id=278)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=278)

Proposed patch

Final proposed patch. The cmake mod's you proposed appear to work. The
additional boost files I use are caught by the original cmake check for
ublas.hpp file (at least in Ubuntu, they're all in the same package).
S


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

--- Comment #9 from Peter Soetens <peter.soetens at fmtc [dot] be>  2008-05-10 00:12:49 ---

(In reply to comment #8)
> Created an attachment (id=278)

 --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=278) [details]

> Proposed patch
>
> Final proposed patch. The cmake mod's you proposed appear to work. The
> additional boost files I use are caught by the original cmake check for
> ublas.hpp file (at least in Ubuntu, they're all in the same package).

Yep. Same here.

Patch is fine, weren't it for the never ending coding style/indentation issues
I'm inflicting upon my peers. Also, the patch could apply on the other deployer
variants as well. We could merge them all in one deployer.cpp file later on.
I'll re-indent the patch and apply it.

Peter


[Bug 538] Unable specify log level when starting deployer

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=538>

Peter Soetens <peter.soetens at fmtc [dot] be> changed:

           What    |Removed                     |Added
 --------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
--- Comment #10 from Peter Soetens <peter.soetens at fmtc [dot] be>  2008-05-10 00:19:57 ---

Thanks. Applied on trunk/ocl.

$ svn ci config/ bin/ -m"Fixes bug #538: Unable specify log level when starting
deployer. Patch by S. Roderick.
deployer.cpp might be merged with other bin/*.cpp files lateron.
"
Sending bin/deployer.cpp
Sending config/check_depend.cmake
Transmitting file data ..
Committed revision 29270.


[Bug 538] Unable specify log level when starting deployer

We missed a file, and I screwed something(s) up. Patch below (with whitespace changes ignored - HTH).
Sorry

ocl $ svn diff -x -b bin/
Index: bin/deployer.cpp
===================================================================
--- bin/deployer.cpp (revision 29270)
+++ bin/deployer.cpp (working copy)
@@ -28,7 +28,7 @@
int ORO_main(int argc, char** argv)
{
std::string script;
- std::string name;
+ std::string name = "Deployer";
std::string logLevel = "info"; // set to valid default

po::options_description desc("Allowed options");
@@ -37,13 +37,13 @@
("help",
"Show program usage")
("start",
- po::value<std::string>(&script)->default_value("config-file.xml"),
- "Deployment configuration file")
+ po::value<std::string>(&script),
+ "Deployment configuration file (eg 'config-file.xml')")
("log-level",
- po::value<std::string>(&logLevel)->default_value("Info"),
+ po::value<std::string>(&logLevel),
"Level at which to log (case-insensitive) Never,Fatal,Critical,Error,Warning,Info,Debug,Realtime")
("DeployerName",
- po::value<std::string>(&name)->default_value("Deployer"),
+ po::value<std::string>(&name),
"Name of deployer component")
;
pos.add("DeployerName", 1);
@@ -62,22 +62,27 @@
}
boost::algorithm::to_lower(logLevel); // always lower case
// verify that is a valid logging level
- if (vm.count("log-level") &&
- (0 == logMap.count(logLevel)))
+ if (vm.count("log-level"))
{
+ if (0 != logMap.count(logLevel))
+ {
+ RTT::Logger::Instance()->setLogLevel(logMap[logLevel]);
+ }
+ else
+ {
std::cout << "Did not understand log level: "
<< logLevel << std::endl
<< desc << std::endl;
return -1;
}
+ }
}
catch (std::logic_error e)
{
- std::cerr << "Exception:" << std::endl << e.what() << std::endl;
+ std::cerr << "Exception:" << e.what() << std::endl << desc << std::endl;
return -1;
}

- RTT::Logger::Instance()->setLogLevel(logMap[logLevel]);
OCL::DeploymentComponent dc( name );

if ( !script.empty() )
Index: bin/CMakeLists.txt
===================================================================
--- bin/CMakeLists.txt (revision 29270)
+++ bin/CMakeLists.txt (working copy)
@@ -4,7 +4,7 @@

ADD_EXECUTABLE( deployer-${OROCOS_TARGET} deployer.cpp )
PROGRAM_ADD_DEPS( deployer-${OROCOS_TARGET} orocos-taskbrowser orocos-deployment )
- TARGET_LINK_LIBRARIES( deployer-${OROCOS_TARGET} ${OROCOS_RTT_LIBS})
+ TARGET_LINK_LIBRARIES( deployer-${OROCOS_TARGET} ${OROCOS_RTT_LIBS} boost_program_options)
INSTALL_TARGETS( /bin deployer-${OROCOS_TARGET} )

ENDIF ( BUILD_TASKBROWSER AND BUILD_DEPLOYMENT)

[Bug 538] Unable specify log level when starting deployer

On Sunday 11 May 2008 19:03:32 snrkiwi wrote:
> We missed a file, and I screwed something up. Patch below (with whitespace
> changes ignored - HTH). Sorry

Thanks. I also won't test this patch :-). I'm really taking the open-source
mantra 'many testers find many bugs' in an uncommon interpretation...

Submitting patches through the orocos.org website is very tricky though. The
patch did not arrive correctly on the mailing list and copy/pasting it from
the website forum is a disaster as well. I'm not inclined to fix the website
now as we'll be 'soon' upgrading to Drupal 6, and maybe that release fixes
these problems by itself.

I got the patch by copy/pasting from the post's edit form. Admin access is a
tiny hurdle for those wanting to try out your patches for now...

Applied, thanks.

Peter

>
> {{{
> ocl $ svn diff -x -b bin/
> Index: bin/deployer.cpp
> ===================================================================
> --- bin/deployer.cpp (revision 29270)
> +++ bin/deployer.cpp (working copy)
> @@ -62,14 +62,20 @@
> }
> boost::algorithm::to_lower(logLevel); // always lower case
> // verify that is a valid logging level
> - if (vm.count("log-level") &&
> - (0 == logMap.count(logLevel)))
> + if (vm.count("log-level"))
> {
> + if (0 != logMap.count(logLevel))
> + {
> + RTT::Logger::Instance()->setLogLevel(logMap[logLevel]);
> + }
> + else
> + {
> std::cout