FrankYang0529 opened a new pull request, #72920:
URL: https://github.com/apache/airflow/pull/72920
## Why
- #52860 registered `[api] access_logfile` as a deprecated alias of `[api]
log_config`, but the two options mean different things. The old option took a
log file path. `log_config` points to a logging configuration file that uvicorn
loads at startup.
- If a deployment still sets `access_logfile`, the API server passes that
path to uvicorn and exits before it can serve requests.
- `airflow config lint` points `[webserver] access_logfile` to `[api]
access_logfile`. Following that advice leads to the same crash.
## How
- Remove the alias from `[api] access_logfile` to `[api] log_config`. Also
remove the alias from `[webserver] access_logfile` to `[api] access_logfile`,
because nothing reads `[api] access_logfile` anymore.
## Verification
- Unit test:
- `uv run --frozen --project airflow-core --with-editable
providers/keycloak --with-editable providers/opensearch pytest
airflow-core/tests/unit/core/test_configuration.py`
- `PYTHONPATH=$(ls -d shared/*/src | tr '\n' ':') uv run --frozen
--project airflow-core pytest
airflow-core/tests/unit/cli/commands/test_config_command.py`
- Integration test: `breeze run --python 3.10 --backend sqlite
--skip-image-upgrade-check --answer n bash -c 'export
AIRFLOW__CORE__LOAD_EXAMPLES=False; airflow db migrate > /tmp/migrate.out 2>&1
|| { echo MIGRATE_FAILED; tail -20 /tmp/migrate.out; exit 1; }; export
AIRFLOW__API__ACCESS_LOGFILE=/tmp/api-access.log; timeout 60 airflow api-server
--port 8080 --workers 1; echo "api-server exit code: $?"'`
- On main branch, this fails like following:
```
[warning ] The access_logfile option in [api] has been renamed to
log_config - the old setting has been used, but please update your config.
Traceback (most recent call last):
...
File ".../airflow/cli/commands/api_server_command.py", line 140, in
_run_api_server_with_uvicorn
uvicorn.run(
File ".../uvicorn/config.py", line 411, in configure_logging
logging.config.fileConfig(self.log_config,
disable_existing_loggers=False)
...
KeyError: 'formatters'
api-server exit code: 1
```
- On this PR, the uvicorn can run successfully.
```
Running the API server with uvicorn:
...
[info ] Application startup complete. [uvicorn.error]
[info ] Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
[uvicorn.error]
...
[info ] Shutting down [uvicorn.error]
api-server exit code: 124
```
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull
request.
Write a good git commit message following this guide:
https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the
documentation.
For user-facing UI changes, please attach before/after screenshots (or a
short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for
a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we
sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR,
please
change below checkbox to `[X]` followed by the name of the tool, uncomment
the "Generated-by".
-->
- [X] Yes - Claude Code
<!--
Generated-by: [Tool Name] following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]