perl - DBI::ProxyServer: Problem with writing a log-file -
when starting proxyserver (dbi::proxyserver) with
dbiproxy --logfile c:\windows\temp\dbiproxy.log --debug 1 --localport 2000
or with
dbiproxy --configfile dbiproxy.config
everything works, except writing of logfile.
dbiproxy config file:
{ 'logfile' => 'c:\windows\temp\dbiproxy.log', 'localport' => '2000', 'debug' => 1, }
i pass filename, net::daemon::log needs filehandle.
code not ok or have missed something?
# net/daemon.pm sub readconfigfile { my($self, $file, $options, $args) = @_; # ... $copts = $file; # ... # override current configuration config file options. while (my($var, $val) = each %$copts) { $self->{$var} = $val; } } sub new ($$;$) { my($class, $attr, $args) = @_; my($self) = $attr ? \%$attr : {}; bless($self, (ref($class) || $class)); $options = ($self->{'options'} ||= {}); # ... # ... $file = $options->{'configfile'} || $self->{'configfile'}; if ($file) { $self->readconfigfile($file, $options, $args); } while (my($var, $val) = each %$options) { $self->{$var} = $val; } # ... # ... $self; } # net/daemon/log.pm sub openlog($) { $self = shift; return 1 unless ref($self); return $self->{'logfile'} if defined($self->{'logfile'}); # ... # ... } sub log ($$$;@) { my($self, $level, $format, @args) = @_; $logfile = !ref($self) || $self->openlog(); # ... # ... if ($logfile) { $logtime = $self->logtime(); # <- far, don't pass "ref($logfile)" if (ref($logfile)) { $logfile->print(sprintf("$logtime $level, $tid$format\n", @args)); } else { printf stderr ("$logtime $level, $tid$format\n", @args); } } elsif (my $eventlog = $self->{'eventlog'}) { # ... # ... }
what putting
'logfile' => io::file->new('c:\windows\temp\dbiproxy.log', 'a'),
into dbiproxy config file? don't have way how test it, according net::daemon::log docs should work.
Comments
Post a Comment