Problem/Motivation

The log does not have the permission defined in the file_chmod_file setting.
In our case, this means that our web server is not able to write to the file:

The logfile could not be opened for writing. Logging to STDERR.

Steps to reproduce

  1. Enable filelog
  2. Generate a logged error
  3. Check the file permissions
  4. Compare with what is defined in file_chmod_file

Proposed resolution

I think we should call FileSystem::chmod() on the file when creating it.

Remaining tasks

I will submit a patch.

User interface changes

API changes

Data model changes

Issue fork filelog-3206920

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review
cburschka’s picture

Assigned: Unassigned » cburschka
Status: Needs review » Needs work

Very good idea.

I'd like to check this function in the unit test, and also make sure that it doesn't cause errors if chmod doesn't work for some reason (I can't remember what edge cases we support for the log file)

cburschka’s picture

Status: Needs work » Needs review
StatusFileSize
new980 bytes
new2.91 KB

Conveniently, the unit test by default creates a file with 0666 permissions in the virtual file system, which the chmod call will set to 0664. This means this patch should cover it, even though the problematic case (too few permissions) doesn't occur here.

The last submitted patch, 5: filelog-3206920-5-testonly.patch, failed testing. View results

  • cburschka committed 88e5a88 on 2.0.x authored by prudloff
    Issue #3206920 by prudloff, cburschka: Log file does not have correct...
cburschka’s picture

Version: 2.0.1 » 2.0.x-dev
Status: Needs review » Fixed

And pushed! Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

senzaesclusiva’s picture

Everythings finally works well
D 8.9.14 /Php 7.4.2/Mysql 5.7.26
D 9.1.8 //Php 7.4.2/Mysql 5.7.26

Many thanks for this patch