Yes, I understand that a service runs a script. With memcached 1.2.2,
you could specify the logfile in the startup script (memcached-start)
in the /usr/local/bin dir. The new version of memcached does not use
memcached-start. I have tried to add redirects to the start script,
but the only thing it puts in the file that I am redirecting to is the
OK that comes when you start or stop the service. the memcached-start
file is actually a perl script. Below is an example of what we used
to run:
#my $fd_reopened = "/dev/null";
my $fd_reopened = "/root/mem.log";
sub handle_logfile {
# my ($logfile) = @_;
my ($logfile) = "/root/mem.log";
$fd_reopened = $logfile;
}
sub reopen_logfile {
# my ($logfile) = @_;
my ($logfile) = "/root/mem.log";
open *STDERR, ">>$logfile";
open *STDOUT, ">>$logfile";
# open *STDIN, ">>/dev/null";
open *STDIN, ">>$logfile";
$fd_reopened = $logfile;
as you can see, we redirected to mem.log. When we upgraded, we found
that memcached 1.2.8 does not use the memcached-start perl script.
that is why I am trying to find a way to do this again.
We are running CentOs 5.2 with memcached 1.2.8
Thanks for your help
On May 6, 12:06 pm, Brett Hoerner <[email protected]> wrote:
> At the end of the day "service" runs a script of some kind. I'm not
> sure what OS you're talking about, but I'm sure there is an init file
> or something like SMF that you can edit, and that's where you want to
> change it to redirect the output.
>
> Brett
>
> On Wed, May 6, 2009 at 12:57 PM, rwthomas <[email protected]> wrote:
>
> > We use it as a service ie: service memcached start. When we run it
> > like this, I haven't been able to redirect the output like you say.
> > if there is a way to do it with that command, I would love to know.
>
> > On May 6, 11:31 am, Trond Norbye <[email protected]> wrote:
> >> On May 6, 2009, at 9:25 AM, rwthomas wrote:
>
> >> > We recently updated to memcached 1.2.8. with the previous version, I
> >> > was log to a file of my choice by adding to the startup file. 1.2.8
> >> > does not seem to have the same ability. I need to send the output of
> >> > memcached to a file other than stdout. Is there a way to do this? If
> >> > not, can this be added in future versions?
>
> >> Why can't you just redirect the output from the memcached server into
> >> a file?
>
> >> ./memcached -vvv > /var/log/memcached.log 2>&1
>
> >> ?
>
> >> Cheers
>
> >> Trond