-
Notifications
You must be signed in to change notification settings - Fork 1k
Enable to set to eventlog output to stdout and stderr #5040
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
base: v3.0
Are you sure you want to change the base?
Enable to set to eventlog output to stdout and stderr #5040
Conversation
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.
Summary of Changes
Hello @takaidohigasi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a significant enhancement by allowing ProxySQL's event and audit logs to be directed to standard output and standard error. This is achieved by modifying the log handling mechanism to recognize and correctly process /dev/stdout
and /dev/stderr
as special device files, bypassing traditional log rotation for these streams. Comprehensive new tests have been added to ensure the robustness and correctness of this new functionality.
Highlights
- Log Output Redirection: Implemented the ability to configure
eventslog_filename
andauditlog_filename
to direct log output to standard streams (/dev/stdout
and/dev/stderr
). - Log Rotation Logic: Modified the log opening routines to prevent log file rotation (e.g., appending
.00000001
) when the target filename is/dev/stdout
or/dev/stderr
, ensuring logs are written directly to the specified stream. - New Test Coverage: Added a new test suite (
test_logger_special_devices-t.cpp
) to validate the correct behavior of setting event and audit logs to standard output/error, including testingFLUSH LOGS
and switching back to regular files.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
Can one of the admins verify this patch? |
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.
Code Review
This pull request enables logging to stdout and stderr by treating /dev/stdout
and /dev/stderr
as special log files that do not get rotated. The changes look good and include a new test file to cover the functionality. There are opportunities to improve the efficiency and maintainability of the code by reducing redundant calls and using safer string manipulation functions.
events.log_file_id=events_find_next_id(); | ||
if (events.log_file_id!=0) { | ||
events.log_file_id=events_find_next_id()+1; | ||
} else { | ||
events.log_file_id++; | ||
} |
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.
The events_find_next_id()
function is called multiple times, which is inefficient and could lead to incorrect behavior if the directory contents change between calls. To avoid this, call the function once and store the result.
events.log_file_id=events_find_next_id(); | |
if (events.log_file_id!=0) { | |
events.log_file_id=events_find_next_id()+1; | |
} else { | |
events.log_file_id++; | |
} | |
events.log_file_id=events_find_next_id(); | |
events.log_file_id++; |
audit.log_file_id=audit_find_next_id(); | ||
if (audit.log_file_id!=0) { | ||
audit.log_file_id=audit_find_next_id()+1; | ||
} else { | ||
audit.log_file_id++; | ||
} |
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.
The audit_find_next_id()
function is called multiple times, which is inefficient and could lead to incorrect behavior if the directory contents change between calls. To avoid this, call the function once and store the result.
audit.log_file_id=audit_find_next_id(); | |
if (audit.log_file_id!=0) { | |
audit.log_file_id=audit_find_next_id()+1; | |
} else { | |
audit.log_file_id++; | |
} | |
audit.log_file_id=audit_find_next_id(); | |
audit.log_file_id++; |
filen=(char *)malloc(strlen(events.base_filename)+1); | ||
strcpy(filen, events.base_filename); |
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.
filen=(char *)malloc(strlen(audit.base_filename)+1); | ||
strcpy(filen, audit.base_filename); |
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.
@gemini-code-assist you have added review for almost the problem for existing code. would you please focus on the change it self? for example, diff of indent change is not treated as change. |
Thank you for your feedback, @takaidohigasi. I understand your concern and appreciate you bringing it to my attention. My primary objective is to provide a thorough review focused on the changes introduced in the pull request. I adhere strictly to the guidelines that require me to limit all suggestions and comments to only the portions of code that are modified within the diff hunks. This ensures that my feedback is directly relevant to the changes you've made. I will continue to prioritize the functional correctness, efficiency, and maintainability of the new or modified code, ensuring that my comments are actionable and focused on the intent of your changes. My analysis is strictly confined to the lines presented in the diff to provide targeted and relevant feedback. |
fef9692
to
fd04840
Compare
|
sorry I tried to add new variables
but it failed, so reverted to the original change. sorry for bothering you. |
if there is any suggestion, please tell me 🙏 |
WHAT
WHY
#5038
Tests