|
List Info
Thread: Adding umask/chmod to FileAppender?
|
|
| Adding umask/chmod to FileAppender? |
  Germany |
2007-07-23 11:43:30 |
Hello
I have the problem that both my console scripts and a web
interface should log
into one file which rotates daily. The problem is that a
file which gets
created by a console script usually has -rw-r--r--
permissions which makes
it impossible for the webserver to write into it. More evil
log4php does not
issue a warning but silently ignores any errors when writing
the logfile :(
Would adding a file_mode=0664 flag to the FileAppender be a
proper way to solve
this problem?
bye,
-christian-
|
|
| Re: Adding umask/chmod to FileAppender? |
  Norway |
2007-07-24 02:44:39 |
Christian Hammers wrote:
> Would adding a file_mode=0664 flag to the FileAppender
be a proper way to solve
> this problem?
>
Have you tried running the console scripts as the same user
as the
webserver?
Example:
$ sudo -u www-data php script.php
log4j doesn't seem to have this feature so I think this is
the right
thing to do.
Knut
|
|
| Re: Adding umask/chmod to FileAppender? |

|
2007-08-01 02:10:23 |
Hello all,
>>>>> "Knut" == Knut Urdalen
<knut php.no> writes:
Knut> Christian Hammers wrote:
>> Would adding a file_mode=0664 flag to the
FileAppender be a
>> proper way to solve this problem?
Knut> Have you tried running the console scripts as
the same user
Knut> as the webserver?
Knut> Example:
Knut> $ sudo -u www-data php script.php
Knut> log4j doesn't seem to have this feature so I
think this is
Knut> the right thing to do.
I disussed almost the same issue with the log4perl guys as
the problem
Christian described is actually a major problem in our
project. I
think it would be a great idea to permit specification of
the file
mode via the configuration.
Regards,
Michael.
|
|
| Re: Adding umask/chmod to FileAppender? |

|
2007-08-03 11:58:22 |
On Aug 1, 2007, at 2:10 AM, Michael Schmitz wrote:
>
> I disussed almost the same issue with the log4perl guys
as the problem
> Christian described is actually a major problem in our
project. I
> think it would be a great idea to permit specification
of the file
> mode via the configuration.
>
I asked for comments on log4net-dev (http://marc.info/?l=log4
net-
dev&m=118598739032116&w=2) and didn't get much
insight beyond don't
have multiple processes hit the same log file (which is a
good and
true statement). log4net has the idea of a nested
securityContext
where you can specify that logging would be done as a
particular user
(which would be one way around the file permissions issue),
but I
have no direct experience with it.
Is there an archive of your discussion with log4perl?
Since umask and chmod both seem to be provided as standard
PHP
library functions, then it seems that PHP is responsible for
emulating or stubbing them on Windows or other platforms
with
different file permission models.
I would suggest that if the user does not specify a umask or
chmod
value, then umask or chmod not be called. Looking at the
original
patch, it seemed like it did not have a concept of an
unspecified
umask. Since both umask and chmod have warnings, I'd
suggest
implementing them both and the user is responsible for
making the
right choice (and if they specified neither than neither
function is
called).
|
|
| Re: Adding umask/chmod to FileAppender? |
  Germany |
2007-08-03 15:35:42 |
Hello
On 2007-08-01 Curt Arnold wrote:
> While trying to explain the situation, it struck me
that the
> motivation in the original posting was problematic. It
is a common
> mistake for log4j users to either intentionally or
unintentionally
> have multiple JVM's attempt to write to the same log
file.
That's a good point, I am indeed in danger of this situation
with my
several programs configured to write into the same logfile.
Would it be good to add file locking to the log4php
wishlist? I think
it's common to have a big application that consists of
several small
console programs, scripts and web-interfaces that all want
to write
into the same logfile to not have 5 different logfiles to
look into.
bye,
-christian- (who whishes a mixture of log4X and syslog )
|
|
| Re: Adding umask/chmod to FileAppender? |

|
2007-08-06 05:56:34 |
>>>>> "Curt" == Curt Arnold
<carnold apache.org> writes:
Curt> On Aug 1, 2007, at 2:10 AM, Michael Schmitz
wrote:
>> I disussed almost the same issue with the
log4perl guys as the
>> problem Christian described is actually a major
problem in our
>> project. I think it would be a great idea to
permit
>> specification of the file mode via the
configuration.
Curt> I asked for comments on log4net-dev
Curt> (http://marc.info/?l=log4
net- dev&m=118598739032116&w=2) and
Curt> didn't get much insight beyond don't have
multiple processes
Curt> hit the same log file (which is a good and true
statement).
Curt> log4net has the idea of a nested
securityContext where you
Curt> can specify that logging would be done as a
particular user
Curt> (which would be one way around the file
permissions issue),
Curt> but I have no direct experience with it.
Curt> Is there an archive of your discussion with
log4perl?
No, I don't think so. My dicussion regarding an
initialization issue
are in the archive, but this one not.
Curt> Since umask and chmod both seem to be provided
as standard
Curt> PHP library functions, then it seems that PHP
is responsible
Curt> for emulating or stubbing them on Windows or
other platforms
Curt> with different file permission models.
Curt> I would suggest that if the user does not
specify a umask or
Curt> chmod value, then umask or chmod not be called.
Looking at
Curt> the original patch, it seemed like it did not
have a concept
Curt> of an unspecified umask. Since both umask and
chmod have
Curt> warnings, I'd suggest implementing them both
and the user is
Curt> responsible for making the right choice (and if
they
Curt> specified neither than neither function is
called).
This sounds like a good suggestion to me.
|
|
| Re: Adding umask/chmod to FileAppender? |

|
2007-08-07 02:08:52 |
>>>>> "Schmitz" == Michael Schmitz
<Michael.Schmitz tietoenator.com> writes:
>>>>> "Curt" == Curt Arnold
<carnold apache.org> writes:
Curt> On Aug 1, 2007, at 2:10 AM, Michael Schmitz
wrote:
>>> I disussed almost the same issue with the
log4perl guys as the
>>> problem Christian described is actually a
major problem in our
>>> project. I think it would be a great idea
to permit
>>> specification of the file mode via the
configuration.
Curt> I asked for comments on log4net-dev
Curt> (http://marc.info/?l=log4
net- dev&m=118598739032116&w=2) and
Curt> didn't get much insight beyond don't have
multiple processes
Curt> hit the same log file (which is a good and true
statement).
Curt> log4net has the idea of a nested
securityContext where you
Curt> can specify that logging would be done as a
particular user
Curt> (which would be one way around the file
permissions issue),
Curt> but I have no direct experience with it.
Curt> Is there an archive of your discussion with
log4perl?
Schmitz> No, I don't think so. My dicussion regarding
an
Schmitz> initialization issue are in the archive, but
this one
Schmitz> not.
<snip>
I just looked at the manual of the file appender in log4perl
and saw,
that one can specify umask, owner and group (plus some more
options)
for a appender.
|
|
[1-7]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|