Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpKernel] Let Monolog handle the creation of log folder for improved readonly containers handling#58564

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.3fromshyim:patch-3
Jan 5, 2025

Conversation

shyim
Copy link
Contributor

@shyimshyim commentedOct 14, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?no
Deprecations?no
Issues
LicenseMIT

When running Symfony in a Container in readonly mode. Symfony checks if the var/log is writeable and it's not because of readonly FS.

I can set envAPP_LOG_DIR=/tmp/log, to fix the issue. But this folder will be never used as my monolog only outputs to stdout.

Therefore I would suggest removing this completely and let monolog create the folder, only when the user configuration wants this

@nicolas-grekas
Copy link
Member

How will the app behave of monolog is not used? And how does monolog fail if configurated to write there?

@shyim
Copy link
ContributorAuthor

shyim commentedOct 17, 2024
edited
Loading

How will the app behave of monolog is not used?

Novar/log is created

And how does monolog fail if configurated to write there?

When logging it throws a exception:

In StreamHandler.php line 140:                                                                                                                                                                   The stream or file "<project>/var/log/prod-2024-10-17.log" could not be opened in append mode: Failed to open stream: Permission denied    The exception occurred while attempting to log: Error thrown while running command "asdasd". Message: "Command "asdasd" is not defined."                         Context: {"exception":{},"command":"asdasd","message":"Command \"asdasd\" is not defined."}

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 23, 2024
edited
Loading

I think we periodically wonder about this, and the conclusion has also been: a writeable var/log is a feature of the kernel, it doesn't relate to monolog directly.
I think it's fine for apps with non-conventional needs (readonly fs) to have to do a few more tweaks.
APP_LOG_DIR=/tmp/log is the way to go to me.

@shyim
Copy link
ContributorAuthor

Maybe deprecate it for Symfony 8.0, remove this method, and rely only on configuration for path /var/log?

getLogDir is just passed as a parameter to the DI container.

Sure I can set APP_LOG_DIR to tmpdir, it feels hacky. Symfony Cloud (platform.sh) seems to have a hack that this folder is always writeable, it would also improve the official Symfony product

@fabpot
Copy link
Member

As mentioned by@nicolas-grekas, we've had this conversation a few times now. I think more and more containers are read-only nowadays. I'm fine with this change, but probably not as a bug fix for 5.4. I would be ok to merge it in 7.2 though.

shyim reacted with thumbs up emoji

@shyimshyim changed the base branch from5.4 to7.2October 23, 2024 15:27
@shyim
Copy link
ContributorAuthor

updated the target branch

@nicolas-grekasnicolas-grekas modified the milestones:5.4,7.2Oct 25, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpot
Copy link
Member

Thank you@shyim.

@fabpotfabpot merged commite33dbfa intosymfony:7.3Jan 5, 2025
8 of 12 checks passed
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

4 participants
@shyim@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp