Re: [log4perl-devel] set file permissions for Log::Dispatch::FileRotate appender?
On Fri, 2 Nov 2007, Jeff McCarrell wrote:
> I'm using log4perl in the obvious way. We have reqs to set the mode
> of the log file to 0666.
> log4perl.appender.PUSHD.filename=/tmp/pushd.log
> log4perl.appender.PUSHD.mode=append
> log4perl.appender.PUSHD.permissions
> = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH # rotate among 5 log
> files of 10Mbytes each log4perl.appender.PUSHD.size=100kb
> log4perl.appender.PUSHD.max=5
>
> results in 5 files of mode 0; permissions=0666 gets passed as a string
> through the layers, not as an octal number, and results in: --w--wx-wT
> 1 nobody nobody 1063 Nov 2 12:41 pushd.log*
Unless you say explicitly that the right-hand side of a log4perl config
line is Perl code, it's interpreted as a string. So, if you say
log4perl.appender.PUSHD.permission = sub { use POSIX;
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH }
instead, it'll work as intended.
-- Mike
Mike Schilli
[EMAIL PROTECTED]
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl causing perl process to die (fwd)
On Fri, 2 Nov 2007, Bob Strahan wrote:
> However, it seems that if certain filesystem operations are
> performed on the logfile it can cause the logger to execute die(),
> causing my service to die, with the following error
>
> Cannot write to 'D:/Program Files (x86)/My App/logs/logfile.txt':
> Permission denied at D:\Program Files (x86)\My
> App\lib\perllibs\lib/Log/Dispatch/File.pm line 86.
Hmm, this is Log::Dispatch::File's _open_file() function complaining
that an open() failed. Does your service open a files after it's been
running for a while? Typically, Log::Dispatch::File(::Locked) opens the
file only once unless 'close_after_write' is given.
Which version of Windows are you running by the way? On regular XP, it
seems to work as expected.
-- Mike
Mike Schilli
[EMAIL PROTECTED]
> I am using log4perl in a Win32 service that needs to run forever.. However,
> I have encountered a situation where the logger call is executing a die() and
> causing my service to die...
>
>
> The service spawns multiple child processes which run concurrently but all
> log to the same logfile.. We're using File::Locked to avoid contention..
> Extract from our logger config below..
>
> "log4perl.appender.myapp" => "Log::Dispatch::File::Locked",
> "log4perl.appender.myapp.filename" => "D:/Program Files (x86)/My
> App/logs/logfile.txt",
> "log4perl.appender.myapp.mode" => "append",
> "log4perl.appender.myapp.close_after_write" => "true",
> "log4perl.appender.myapp.permissions" => "0660",
> Etc..
>
>
> I can reproduce the problem sporadically by simply opening the logfile in
> Wordpad..
> I can reproduce it reliably by repeatedly copying the logfile using test
> script below
>
> #!perl -w
> use File::Copy ;
> while (1) {
>copy ("D:/Program Files (x86)/My App/logs/logfile.txt", "D:/Program Files
> (x86)/My App/logs/logfileCOPY.txt") ;
>print "." ;
> }
>
>
> Any suggestions on how to defend against users copying or opening the
> logfile? We should block and retry until open() suceeds, rather than die(),
> I think.
>
> Please let me know if you can help with a patch, workaround, or suggestion.
>
> Regards
>
>
>
> Bob Strahan
> HP Software, R&D
>
> 703.579.1929 office | 702.967.5228 mobile | 702.579.1929 fax | [EMAIL
> PROTECTED]
> 10700 Parkridge Blvd. #500 | Reston | VA 20191
>
>
> -
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ___
> log4perl-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] appender/dispatcher that writes to per-category files
From: Jonathan Swartz <[EMAIL PROTECTED]> To: [email protected] Subject: appender/dispatcher that writes to per-category files Date: Thu, 1 Nov 2007 17:00:36 -0700 I'd like to write simultaneously to a central log file, and to a separate log file for each category. e.g. A log to category Foo.Bar would go to app.log and Foo.Bar.log. I want to do this automatically rather than having to configure each category separately. Before I set out to create this, I was curious if anyone else has done this and has advice, or if there is an existing appender/ dispatcher that does this (couldn't find anything on cpan). Seems like one of the potential problems will be reaching a maximum number of open file handles, given the large number of possible categories. So I might have to maintain a "cache" of open filehandles, closing old ones as needed when reaching a limit. Feedback appreciated. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ log4perl-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] appender/dispatcher that writes to per-category files
On Sat, 3 Nov 2007, Mike Schilli wrote: > I'd like to write simultaneously to a central log file, and to > a separate log file for each category. e.g. A log to category Foo.Bar > would go to app.log and Foo.Bar.log. I want to do this automatically > rather than having to configure each category separately. Interesting problem ... do you know ahead of time which categories you're gonna run into? A script could call all kinds of Log4perl-enabled modules at runtime, adding new categories on-the-fly. -- Mike Mike Schilli [EMAIL PROTECTED] > Before I set out to create this, I was curious if anyone else has done > this and has advice, or if there is an existing appender/ dispatcher > that does this (couldn't find anything on cpan). > > Seems like one of the potential problems will be reaching a maximum > number of open file handles, given the large number of possible > categories. So I might have to maintain a "cache" of open > filehandles, closing old ones as needed when reaching a limit. > > Feedback appreciated. > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > log4perl-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ log4perl-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/log4perl-devel
