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

Update for supporting multiple logging level settings #290

Merged

Conversation

iuhilnehc-ynos
Copy link
Contributor

Signed-off-by: Chen Lihui [email protected]

@iuhilnehc-ynos
Copy link
Contributor Author

To support multiple logging level settings, there might exist some other ways which could be convenient for users, such as

    a. use multiple items "--log-level", such as  
        
        --log-level debug --log-level talker1=error --log-level talker2=warn

    b. use one item, such as
        
        --log-level debug,talker1=error,talker2=warn

But to keep consistent with other arguments that using multiple items and use := as a separator, such as

--ros-args --param key1:=value1 --param key2:=value2

I wonder if users would like to use the multiple logger level setting as follows,

--log-level debug,talker1:=error,talker2:=warn

or just use

--log-level debug --log-level talker1:=error --log-level talker2:=warn

I'd like to hear your opinions.

@fujitatomoya
Copy link
Collaborator

But to keep consistent with other arguments that using multiple items and use := as a separator, such as

for user experience, i'd like to go with := separator to keep the consistency.

@iuhilnehc-ynos
Copy link
Contributor Author

But to keep consistent with other arguments that using multiple items and use := as a separator, such as

for user experience, i'd like to go with := separator to keep the consistency.

@fujitatomoya
Thanks. I agree with you.

There are some ways to use :=,

A. --log-level debug,talker1:=error,talker2:=warn
B. --log-level debug --log-level talker1:=error --log-level talker2:=warn
C. both A and B

I think I need to hear others' suggestions.

@gbiggs
Copy link
Member

gbiggs commented Jun 29, 2020

Option A makes sense if you consider it to be the combination of all specifications given in option B. I think that option B is clearer and easier to parse, though.

@gbiggs
Copy link
Member

gbiggs commented Jun 29, 2020

What is the order of precedence if someone gives two different logging levels for a single node?

@iuhilnehc-ynos
Copy link
Contributor Author

What is the order of precedence if someone gives two different logging levels for a single node?

the last one wins

@gbiggs
Copy link
Member

gbiggs commented Jun 29, 2020

Then the design document must say that.

@iuhilnehc-ynos
Copy link
Contributor Author

Then the design document must say that.

Thanks. But I think it's the policy of all arguments, not just for --log-level. So maybe it should not be recorded here.

@gbiggs
Copy link
Member

gbiggs commented Jun 29, 2020

If you choose option A then it matters because the argument parser will only see a single argument, and whatever parses that string will need to know what to do.

@iuhilnehc-ynos
Copy link
Contributor Author

If you choose option A then it matters because the argument parser will only see a single argument, and whatever parses that string will need to know what to do.

After reconsideration, I think I will use option B. (Actually I use option B in the design file).
No need to break the existing rule ( --param doesn't support --param key1:=value1,key2:=value2 )

@iuhilnehc-ynos
Copy link
Contributor Author

@gbiggs
Anyway, thanks for your suggestion. (option B is an easy way)

@fujitatomoya
Copy link
Collaborator

fujitatomoya commented Jun 29, 2020

I am really good to go with either one.

@fujitatomoya
Copy link
Collaborator

@ivanpauno @hidmic @wjwwood

friendly ping.

@ivanpauno
Copy link
Member

What is the order of precedence if someone gives two different logging levels for a single node?

We currently have a lot of inconsistencies on how argument precedence works, I recently opened a PR about that.

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

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

As @gbiggs suggested, I think it's good to clarify precedence order.
Using a "last specified argument prevails" rule sounds like a good idea.

This proposal is pretty consistent with how we parse other kinds of arguments, 👍 to that!

articles/150_ros_command_line_arguments.md Outdated Show resolved Hide resolved
articles/150_ros_command_line_arguments.md Outdated Show resolved Hide resolved
articles/150_ros_command_line_arguments.md Outdated Show resolved Hide resolved
articles/150_ros_command_line_arguments.md Outdated Show resolved Hide resolved
@ivanpauno
Copy link
Member

A. --log-level debug,talker1:=error,talker2:=warn
B. --log-level debug --log-level talker1:=error --log-level talker2:=warn
C. both A and B

I would also like to mention that option C sounds reasonable to me.
But in that case, we should support similar syntax for arguments and parameters:

ros2 run package_name exec_name --ros-args -p param1:=value1,param2:=value2

That would be a much bigger effort that only implementing the new log level arguments.
I would try to keep the proposal as minimal as possible.

@ivanpauno
Copy link
Member

@clalancette FYI

@clalancette
Copy link
Contributor

A. --log-level debug,talker1:=error,talker2:=warn
B. --log-level debug --log-level talker1:=error --log-level talker2:=warn
C. both A and B

While I have my own personal preferences, I think consistency is more important here. With that in mind, I'd definitely stick with the := as the separator, as that is consistent with parameters.

I would also stick with option B here, as it more closely conforms to what parameters are doing. If we want to expand in the future to support syntax A, we would do it across all of the parameters we support.

@wjwwood
Copy link
Member

wjwwood commented Jun 29, 2020

I agree with B, until we want to support something like A everywhere, aka C.

CHEN and others added 2 commits June 30, 2020 09:48
Co-authored-by: Ivan Santiago Paunovic <[email protected]>
Signed-off-by: Chen Lihui <[email protected]>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

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

I think it's worth clarifying the precedence in the design article.

@clalancette
Copy link
Contributor

Both Ivan and I are happy with this. I'll let this sit another day before merging to see if there are any additional comments on this proposal, then I'll merge. Pinging @wjwwood @gbiggs for any other thoughts.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm

I only had two nitpick comments that could be addressed or ignored.


```sh
ros2 run some_package some_ros_executable --ros-args --log-level DEBUG
```

Some specific loggers can be set using the `--log-level` option as well:
Copy link
Member

Choose a reason for hiding this comment

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

So does Some here mean there are loggers you cannot set this way? If not, I'd drop it. If so, then I think we need some clarification on that.

Some specific loggers can be set using the `--log-level` option as well:

```sh
ros2 run some_package some_ros_executable --ros-args --log-level talker1:=DEBUG --log-level talker2:=WARN
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to have an example that's not just a node, like maybe rclcpp or talker1.rclcpp or something more interesting like that.

@gbiggs
Copy link
Member

gbiggs commented Jul 2, 2020

LGTM

Signed-off-by: Chen Lihui <[email protected]>
Co-authored-by: William Woodall <[email protected]>
@clalancette
Copy link
Contributor

I'm going to go ahead and merge this with the latest fixes now. Thanks everyone for reviewing this and moving it forward.

@clalancette clalancette merged commit e3b3835 into ros2:gh-pages Jul 6, 2020
mlanting pushed a commit to mlanting/design that referenced this pull request Aug 17, 2020
* Update for supporting multiple logging level settings

Signed-off-by: Chen Lihui <[email protected]>
Co-authored-by: tomoya <[email protected]>
Co-authored-by: Ivan Santiago Paunovic <[email protected]>
Co-authored-by: William Woodall <[email protected]>
mlanting pushed a commit to mlanting/design that referenced this pull request Aug 17, 2020
* Update for supporting multiple logging level settings

Signed-off-by: Chen Lihui <[email protected]>
Co-authored-by: tomoya <[email protected]>
Co-authored-by: Ivan Santiago Paunovic <[email protected]>
Co-authored-by: William Woodall <[email protected]>
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.

6 participants