-
-
Notifications
You must be signed in to change notification settings - Fork 10.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
fix:Optimize the default log path configuration #5251
fix:Optimize the default log path configuration #5251
Conversation
WalkthroughThe pull request updates the documentation for local development in both English and Chinese, enhancing clarity regarding the setup requirements, particularly emphasizing the necessity of MySQL for database creation. Instructions for running configurations and verifying service health have been detailed. Additionally, the logging file paths in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🔇 Additional comments (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (4)
apollo-configservice/src/main/resources/application.yml (1)
36-37
: Approve changes with suggestions for improvementThe changes to the logging configuration align well with the PR objectives. Splitting
logging.file.name
intologging.file.path
andlogging.file.name
leverages Spring Boot 2.3+ features to automatically create log files, addressing the local startup issue.Suggestions for improvement:
- Consider using environment-specific configurations for the log path. The hard-coded
/opt/logs
might not be suitable for all environments, especially for local development.- Verify that similar changes have been made in other
application.yml
files (e.g., for apollo-adminservice and apollo-assembly) to maintain consistency across the project.- Add a comment explaining the reason for this configuration change, to provide context for future developers.
Example implementation:
logging: file: # Split logging configuration to leverage Spring Boot 2.3+ automatic log file creation path: ${APOLLO_LOG_DIR:/opt/logs} name: apollo-configservice.logThis uses an environment variable
APOLLO_LOG_DIR
with a default fallback to/opt/logs
, allowing for more flexible configuration across different environments.docs/zh/contribution/apollo-development-guide.md (1)
69-69
: LGTM! Consider adding a note about directory creation.The added information about modifying the log file path is accurate and helpful. It aligns well with the PR objective of optimizing the default log path configuration.
Consider adding a note that the specified directory should exist or be created by the user before starting the application. This can help prevent potential issues for users who might specify a non-existent directory.
docs/en/contribution/apollo-development-guide.md (2)
78-80
: Clarify log file configurationThe note about the default log output path has been updated, but there's a small issue with the wording. Consider revising it for clarity:
- >Note 3: The default log output of the program is /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add the `logging.file.name` parameter, as follows. + >Note 3: The default log output path of the program is /opt/logs/apollo-assembly.log. If you need to modify the log file path, you can add the `logging.file.name` parameter, as follows:This change improves readability and corrects the grammar issue flagged by the static analysis tool.
🧰 Tools
🪛 LanguageTool
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
Line range hint
113-117
: Improved sample client setup instructionsThe updates to both Java and .Net sample client setup instructions are excellent. They provide clearer guidance on configuring the project AppId and explain its importance in the Apollo ecosystem. This will help developers better understand how Apollo works with different applications.
For consistency, consider adding a note about the importance of AppId in the .Net section similar to the one in the Java section:
> Note: AppId is the unique identity of the application, which is used by Apollo clients to get the application's own private Namespace configuration. > For public Namespace configurations, you can get the configuration without the AppId, but then you lose the ability for the application to override the public Namespace configuration.This addition would ensure that .Net developers have the same level of understanding as Java developers regarding the significance of AppId.
Also applies to: 149-153, 176-180
🧰 Tools
🪛 LanguageTool
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- apollo-adminservice/src/main/resources/application.yml (1 hunks)
- apollo-assembly/src/main/resources/application.yml (1 hunks)
- apollo-configservice/src/main/resources/application.yml (1 hunks)
- docs/en/contribution/apollo-development-guide.md (1 hunks)
- docs/zh/contribution/apollo-development-guide.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/en/contribution/apollo-development-guide.md
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
🔇 Additional comments (5)
apollo-adminservice/src/main/resources/application.yml (1)
36-37
: Approved: Improved logging configurationThis change optimizes the default log path configuration by separating the log file path and name. It aligns with Spring Boot best practices (version 2.3+) and addresses the issue mentioned in the PR description where log files weren't automatically created.
Benefits:
- Increased flexibility in managing log locations.
- Maintains consistency with the previous log file path and name.
- Allows Spring Boot to automatically create the log file, preventing startup errors due to missing log files.
apollo-assembly/src/main/resources/application.yml (1)
33-34
: Approve: Improved logging configurationThe changes to the logging configuration are well-implemented and align with Spring Boot best practices. By separating the
path
andname
properties, this configuration:
- Allows Spring Boot to automatically create the log directory if it doesn't exist, preventing startup errors.
- Maintains the same effective log file path (/opt/logs/apollo-assembly.log).
- Improves flexibility for future changes to either the log directory or file name.
This change successfully addresses the PR objective of optimizing the default log path configuration and resolves the issue of log files not being created automatically when starting the application locally.
docs/en/contribution/apollo-development-guide.md (3)
Line range hint
12-14
: Improved clarity on database requirementsThe changes in this section provide better guidance on the local runtime environment requirements. The addition of the H2 database option offers more flexibility for developers, which is particularly useful for those who prefer not to set up MySQL for local development.
🧰 Tools
🪛 LanguageTool
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
Line range hint
60-73
: Improved MySQL configuration instructionsThe added details for MySQL database configuration are very helpful. They provide clear instructions on how to set up the necessary VM options for both the Config and Portal databases, which will make it easier for developers to get started with a MySQL setup.
🧰 Tools
🪛 LanguageTool
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
Line range hint
91-103
: Valuable addition of health check instructionsThe new instructions for verifying service health through the Eureka interface and health check endpoints are excellent additions. They provide developers with clear steps to confirm that their services are running correctly, which is crucial for local development and troubleshooting.
🧰 Tools
🪛 LanguageTool
[grammar] ~78-~78: “Default” is a singular noun. It appears that the verb form is incorrect.
Context: ...olloportaldb.sql) >Note 3: The default log output of the program is /opt/logs/apol...(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[style] ~78-~78: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s /opt/logs/apollo-assembly.log, if you need to modify the log file path, you can add t...(REP_NEED_TO_VB)
path: /opt/logs | ||
name: apollo-assembly.log |
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.
💡 Codebase verification
Issues Detected with Logging Configuration
- The log directory
/opt/logs
does not exist. - The log file
apollo-assembly.log
is missing.
These issues may prevent the application from logging correctly, which can hinder troubleshooting and monitoring. Please address the missing log directory and file to ensure proper logging functionality.
🔗 Analysis chain
Verify the new logging configuration
While the changes look good, it's important to verify that they work as expected in different environments. Please ensure:
- The log file is created at
/opt/logs/apollo-assembly.log
when the application starts. - The application starts without any logging-related errors.
- Log entries are correctly written to the new file.
- The changes work consistently across all environments (development, staging, production).
To assist with verification, you can run the following script:
This script will help verify the existence and permissions of the log directory and file, check for any logging-related errors, and ensure the application is logging correctly.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the new logging configuration
# Check if the log directory exists
if [ -d "/opt/logs" ]; then
echo "Log directory exists: /opt/logs"
else
echo "Error: Log directory does not exist: /opt/logs"
fi
# Check if the log file exists
if [ -f "/opt/logs/apollo-assembly.log" ]; then
echo "Log file exists: /opt/logs/apollo-assembly.log"
# Check if the log file is writable
if [ -w "/opt/logs/apollo-assembly.log" ]; then
echo "Log file is writable"
else
echo "Error: Log file is not writable"
fi
# Check for any error messages related to logging in the log file
if grep -i "error" "/opt/logs/apollo-assembly.log"; then
echo "Warning: Found error messages in the log file"
else
echo "No error messages found in the log file"
fi
else
echo "Error: Log file does not exist: /opt/logs/apollo-assembly.log"
fi
# Check for any logging-related error messages in the application output
if journalctl -u apollo-assembly | grep -i "error.*logging"; then
echo "Warning: Found logging-related error messages in the application output"
else
echo "No logging-related error messages found in the application output"
fi
Length of output: 580
Is it only for local development? As there are logics to create the log folders in the startup.sh apollo/apollo-portal/src/main/scripts/startup.sh Lines 23 to 26 in 4bdf66a
|
Yes, it is currently a problem in local development |
It doesn't work for me. The |
Hi, you are right. I did a test and changed the path to a non-existent path under $HOME and found that it can start normally. |
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.
LGTM
What's the purpose of this PR
Which issue(s) this PR fixes:
Fixes #
Brief changelog
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.Summary by CodeRabbit
Summary by CodeRabbit
New Features
Documentation