Repository navigation
feat: make separate access log opt-in via ACCESS_LOG_FILE_PATH - #2205
Merged
Merged
Conversation
Previously the access-log split (#2199) always defaulted to log/access.log even when ACCESS_LOG_FILE_PATH wasn't set. Now it's nil unless the env var is explicitly set: - config/runtime.exs: no default path, :access_log backend/config only configured when set, :info's metadata_reject only applies then too. - application.ex: AccessLogger.attach() (which detaches Phoenix's own request-logging handlers) only runs when :access_log is configured. When unset, behavior is 100% unchanged from before #2199: single combined info.log, Phoenix's default request logger untouched.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ACCESS_LOG_FILE_PATH(#2199) always defaulted tolog/access.logeven whenunset, meaning every deployment silently started splitting HTTP access lines
into a second file/backend and detaching Phoenix's default request logger,
whether or not that was wanted.
What
config/runtime.exs:access_log_file_pathis nownilunlessACCESS_LOG_FILE_PATHis explicitly set (no computed default). The:access_loglogger config, itsLoggerFileBackendentry, and:info'smetadata_rejectare only applied when it's set.lib/ae_mdw/application.ex:AeMdw.APM.AccessLogger.attach()(whichdetaches Phoenix's own request-logging telemetry handlers) only runs when
Application.get_env(:logger, :access_log)is configured.When the env var is unset, behavior is byte-for-byte the same as before #2199
ever existed: single combined
info.log, Phoenix's default request loggeruntouched. Opting in requires explicitly setting
ACCESS_LOG_FILE_PATH.Verification
mix format --check-formatted && mix credo— clean.mix dialyzer --format github— passed successfully.mix test test/ae_mdw_web/— 537/537 passing.