Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting log levels in DDS implementation #124

Merged
merged 9 commits into from
Jan 18, 2018

Conversation

sriramster
Copy link
Contributor

…l DDS api's

  • This patch enables support for three basic log levels
  • There needs an API inside the DDS specific rmw implementation i.e
    rmw_fastrtps/rmw_opensplice etc to convert the enum to DDS specific variable

Signed-off-by: Sriram Raghunathan sriram.max@gmail.com

…l DDS api's

* This patch enables support for three basic log levels
* There needs an API inside the DDS specific rmw implementation i.e
  rmw_fastrtps/rmw_opensplice etc to convert the enum to DDS specific variable

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@dirk-thomas
Copy link
Member

The package rcutils defines logging levels and a logging API:https://github.com/ros2/rcutils/blob/6d6d5507362415fd377098c0b5973b91072dfafa/include/rcutils/logging.h#L60-L67 These should be used in rmw (or at least be referenced by rmw specific symbols).

@sriramster
Copy link
Contributor Author

I'll change the patch accordingly, I did check rcutils for the same. But missed checking for the actual enum.

@sriramster
Copy link
Contributor Author

Hi @dirk-thomas

I read the code from rcutils and rmw, find two ways of doing it.

  • To define rmw specific log_level enums and convert rcutil specific enum types to rmw specific ones.
  • Or to use rcutil types inside API's which might not need any changes inside rmw.h by doing that we'll have to include rcutils/logging.h inside rmw_implementation (I don't see this as the right approach) we are going against the design of rmw and rcutils already followed.

Let me know your thoughts on this.

@dirk-thomas
Copy link
Member

I would suggest to define an rmw specific enum but use the enum values from rcutils to define their values. That way the rmw API uses rmw types but is still compatible with rcutils.

ros2#124 (comment)

Using rcutils based log level, mapping them onto rmw specific
ones.

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@sriramster
Copy link
Contributor Author

Hi @dirk-thomas

Have update the pull request based on the discussions above. Could you review the changes?

Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside the minor comments the added enum looks fine.

Please also add the new function declaration to actually pass the log severity.

@@ -229,6 +231,18 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t

enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0};

// Creating a map of rcutil log level types to
// rmw specific types. Check with dds available types
// before using these.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the DDS reference from the comment since the rmw interface doesn't require it to be implemented by DDS.

// Creating a map of rcutil log level types to
// rmw specific types. Check with dds available types
// before using these.
enum RMW_PUBLIC_TYPE rmw_log_level_t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use consistent terms: severity instead of level.

enum RMW_PUBLIC_TYPE rmw_log_level_t
{
RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG,
RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the double space to align the equal sign.

Same next line.

@mikaelarguedas mikaelarguedas added the in progress Actively being worked on (Kanban column) label Oct 18, 2017
…onsistency.

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@sriramster
Copy link
Contributor Author

@dirk-thomas fixed the comments. Have a look and let me know.

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>
sriramster pushed a commit to sriramster/rmw_implementation that referenced this pull request Oct 20, 2017
ros2/rmw#124 url on rmw.

The patch enables setting log severity from userland applications. The parameter
passed is defined inside rmw/include/types.h

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@dirk-thomas
Copy link
Member

Please also add the new function declaration to actually pass the log severity.

This comment is still pending.

@sriramster
Copy link
Contributor Author

@dirk-thomas ros2/rmw_implementation#30 (comment) have implemented the same here.

@dirk-thomas
Copy link
Member

dirk-thomas commented Oct 24, 2017

The new function also needs to be declared in this file: https://github.com/ros2/rmw/blob/master/rmw/include/rmw/rmw.h

And then it needs to be implemented for all currently supported rmw implementations: rmw_fastrtps_cpp, rmw_connext_cpp, rmw_opensplice_cpp.

patches across ros2 sources for setting log levels inside DDS
implementation

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@sriramster
Copy link
Contributor Author

@dirk-thomas the API is included in rmw/rmw.h. I'll update the rmw_dds specific ones in other commits.

…as'nt needed

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
sriramster pushed a commit to sriramster/rmw_fastrtps that referenced this pull request Oct 25, 2017
ros2/rmw#124

* The API defined is used to set the logging level particular to the DDS
implementation.
* This change is specific to DDS type Fast-RTPS.
* The file is named as rmw_configure since we could write API's of type
  'system level config setting' types here.

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>
Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
@dirk-thomas
Copy link
Member

I have added the phrase "Connect to " to the initial description of the related PRs so that they are being grouped on the Waffle.io board.

@sriramster
Copy link
Contributor Author

@dirk-thomas I've updated the patch sets on all the linked commits. Could you review?

Except for one discussion which is still active.

@sriramster
Copy link
Contributor Author

@dirk-thomas @dhood Could you please review this patch? This is connected to another approved patch by Dirk

@dirk-thomas
Copy link
Member

I triggered a set of builds with these changes:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

I think the failures are because your branches are forked from a much older version. Can you please rebase all PRs to the latest state of the default branch. Then I can rerun the CI builds.

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>
@sriramster
Copy link
Contributor Author

@dirk-thomas Have update all the connecting PR's to master. Could you please trigger the CI build? Just asking, may I trigger the build in future? (If I'm allowed to do so, could you share an link or document for the same?)

@dirk-thomas
Copy link
Member

Could you please trigger the CI build?

  • Linux skipped
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows aborted

The code doesn't compile. Please make sure to compile your changes locally, run the tests and once that passed successfully request a new round of CI build.

Just asking, may I trigger the build in future?

Currently we can't provide access to ci.ros2.org. In the future build.ros2.org should provide that service to the community.

@sriramster
Copy link
Contributor Author

@dirk-thomas fixed the error, creeped in due to the change from error msg setting to parameterized logging made. Could you check now? I've compiled, tested. And, it is passing locally.

@dirk-thomas
Copy link
Member

dirk-thomas commented Jan 5, 2018

Some linters still fail (they should have also failed for you locally?):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sriramster
Copy link
Contributor Author

@dirk-thomas Done. Missed them again! I need to practice "ros" style more. Sorry again.

@dirk-thomas
Copy link
Member

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Please also address the compiler warnings reported: http://ci.ros2.org/job/ci_linux/3848/warnings22Result/new/

@sriramster
Copy link
Contributor Author

@dirk-thomas checked, it is due to unused parameter "severity" with our new API's, would you like a (void) severity; declaration just to nullify the warning. The better solution would be to implement the logging usage with connext and opensplice. Let me know your thoughts on this.

@dirk-thomas
Copy link
Member

As mentioned before implementing the currently empty functions is the goal. If you would like to merge the current set of PR before that happens please use (void)severity to avoid the warning.

@sriramster
Copy link
Contributor Author

@dirk-thomas Thanks. I've made the necessary changes to prevent the warning on the connected patches.

@dirk-thomas
Copy link
Member

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

I can't say if the remaining test failure are related to the patch or have a different cause. Will need to be checked before merging...

@sriramster
Copy link
Contributor Author

@dirk-thomas I checked those from the logs. They don't seem like regressions because of our changes. Could you let me know if you've found the cause for the same?

dirk-thomas pushed a commit to ros2/rmw_implementation that referenced this pull request Jan 18, 2018
* The patch follows the discussion at this

ros2/rmw#124 url on rmw.

The patch enables setting log severity from userland applications. The parameter
passed is defined inside rmw/include/types.h

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Changing rmw_log_severity_t from const * to rmw_log_severity_t
addressing comments

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>
dirk-thomas pushed a commit to ros2/rmw_fastrtps that referenced this pull request Jan 18, 2018
* Fastrtps supports rich logging facilities, which could be used on any ros2 development.

* To enable the same, enable setting log levels from rmw_fastrtps layers,
* Add generic logging level parameters to 'rmw.h' which would be used by other
  layers above like rcl/rclcpp.
* Hide DDS specific implementation inside rmw_fastrtps.

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* The changes follow the discussions

ros2/rmw#124

* The API defined is used to set the logging level particular to the DDS
implementation.
* This change is specific to DDS type Fast-RTPS.
* The file is named as rmw_configure since we could write API's of type
  'system level config setting' types here.

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>

* Rename file from rmw_fastrtps_configure to rmw_logging, which follows the patterns being used already.

like rmw_node, rmw_publisher..

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* - Fix, coding errors.
- Renmae API to suite ros styles

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Fix ament_cpplint warnings

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Remove utility function to create a 'error' returnable API for setting logging

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>

* Fix, logging msg bug.

* Modify logging mapping for type 'debug' from warning to info.

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>

* order log levels, use different local variable name, include unknown severity in error message

* Fix error due to parameterized logging

* Fix code style issues from uncrustify
@dirk-thomas dirk-thomas merged commit d75889e into ros2:master Jan 18, 2018
@dirk-thomas
Copy link
Member

Thank you for the patches.

Please try to follow up with pull requests to add the missing implementation for Connext and OpenSplice when you have a chance.

@dirk-thomas dirk-thomas removed in progress Actively being worked on (Kanban column) requires-changes labels Jan 18, 2018
@sriramster
Copy link
Contributor Author

Thank you. Sure, I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants