-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
libc/stdout: add an option to redirect standard output stream to syslog #14923
base: master
Are you sure you want to change the base?
Conversation
Redirect standard output stream of printf(), vprintf(), puts(), putchar() to syslog, This option will ensure the printing sequence of syslog/printf to avoid confusion. Noted that if enable this option, the redirection capability of standard input(<) and output(>) will not be work as expect in (nsh)nuttx shell. Signed-off-by: chao an <[email protected]>
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides a summary and testing information, it lacks crucial details. Here's a breakdown:
In short: The PR needs more detail and more thorough testing to meet the NuttX requirements. It needs to clearly explain the motivation, fully document the impact (especially the broken redirection), and include more comprehensive testing. |
@@ -407,5 +407,25 @@ config SYSLOG_REGISTER | |||
---help--- | |||
This option will support register the syslog channel dynamically. | |||
|
|||
config SYSLOG_STDOUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why not enable CONFIG_CONSOLE_SYSLOG? which just do what you want but in an elegant way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also need support input from console. It seems CONSOLE_SYSLOG only support output to syslog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly speaking, i don't think it makes much sense to have a kconfig for this specific exotic configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, do you have a better solution? The current implementation minimizes the impact for framework changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i don't understand what problem you want to solve.
your description only says "avoid confusion."
if the problem is that your application is using syslog and printf in a way which somehow confuses you,
the most straightforward solution would be to fix your application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither printf nor syslog can guarantee the integrity of printing, they are have different protection mechanisms in the backend implementation(txsem/csection)
what kind of "the integrity of printing" are you talking about?
after all, syslog and stdout are two separate streams.
i suspect you are expecting too much.
The application is an open-source project. It is impossible to change all stdout to syslog().
are you saying that my guess is correct? ie. it's a problem in your application.
This option is a configurable function, and default value is n, which won't impact anyone.
it affects developers by complicating the configuration matrix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of "the integrity of printing" are you talking about?
after all, syslog and stdout are two separate streams.
i suspect you are expecting too much.
- This isn't a problem that I've encountered personally. Many developers in project have been complaining about it. It's a point that needs to be improved.
are you saying that my guess is correct? ie. it's a problem in your application.
- Why? Is there any conflict between call which interface with ensuring complete line output? These are two different issues.
it affects developers by complicating the configuration matrix.
- Do you still remember that you submitted over 1,000 commits to fix the printing issue? Type mismatch and printf format fixes #2312? Every time I go through the git history, I'll see all this junk. could I say that you've affected me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depending on the problem you want to solve, (i'm not sure what it is yet)
writing a character device driver for /dev/console
can be a less intrusive (and IMO less confusing) solution i guess.
as @xiaoxiang781216 pointed out, it can be similar to what CONFIG_CONSOLE_SYSLOG
does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of "the integrity of printing" are you talking about?
after all, syslog and stdout are two separate streams.
i suspect you are expecting too much.1. This isn't a problem that I've encountered personally. Many developers in project have been complaining about it. It's a point that needs to be improved.
maybe the problem is obvious for many developers as you say.
but it isn't for me.
can you please give me a reference?
are you saying that my guess is correct? ie. it's a problem in your application.
2. Why?
i suggested to fix your application if it's a problem in your application.
you answered it's unrealistic to fix the application.
so i thought you were implying that the premise (it's a problem in your application) was true.
Is there any conflict between call which interface with ensuring complete line output? These are two different issues.
sorry, i don't understand what you mean here. what are two issues?
it affects developers by complicating the configuration matrix.
3. Do you still remember that you submitted over 1,000 commits to fix the printing issue? [Type mismatch and printf format fixes #2312](https://github.com/apache/nuttx/pull/2312)? Every time I go through the git history, I'll see all this junk. could I say that you've affected me?
maybe. sorry for affecting you.
however, the confusion this PR would introduce is in another level, IMO.
applications usually do not expect fputs(stdout)
and puts
works so differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other possible solutions i can think of are
#define printf(...) something-with-syslog
when building your application- use something like syslog_devchannel.c to redirect syslog to your console device
bool "Redirect standard output stream of printf() and vprintf() to syslog" | ||
default n | ||
---help--- | ||
Redirect standard output stream of printf(), vprintf(), puts(), putchar() to syslog, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard output is not a per-function entity.
"standard output stream of printf()" doesn't make sense.
@@ -407,5 +407,25 @@ config SYSLOG_REGISTER | |||
---help--- | |||
This option will support register the syslog channel dynamically. | |||
|
|||
config SYSLOG_STDOUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly speaking, i don't think it makes much sense to have a kconfig for this specific exotic configuration.
Summary
libc/stdout: add an option to redirect standard output stream to syslog
Redirect standard output stream of printf(), vprintf(), puts(), putchar() to syslog,
This option will ensure the printing sequence of syslog/printf to avoid
confusion. Noted that if enable this option, the redirection
capability of standard input(<) and output(>) will not be work as expect in
(nsh)nuttx shell.
Signed-off-by: chao an [email protected]
Impact
N/A
Testing
sim/nsh
enable SYSLOG_STDOUT/SYSLOG_STDOUT_PREFIX
test code in hello