disable debug messages in APIDaemon by default

This commit is contained in:
Dietmar Maurer 2011-09-29 08:09:51 +02:00
parent 78e9f56599
commit ecbca9c355
2 changed files with 15 additions and 3 deletions

View File

@ -34,6 +34,16 @@ my $max_requests = 500; # max requests per worker
my $child_terminate = 0; my $child_terminate = 0;
my $child_reload_config = 0; my $child_reload_config = 0;
my $debug_enabled;
sub enable_debug {
$debug_enabled = 1;
}
sub debug_msg {
return if !$debug_enabled;
syslog('info', @_);
}
sub worker_finished { sub worker_finished {
my $cpid = shift; my $cpid = shift;
@ -265,7 +275,7 @@ sub handle_requests {
my $method = $r->method(); my $method = $r->method();
syslog('info', "perl method $method"); debug_msg("perl method $method");
if (!$known_methods->{$method}) { if (!$known_methods->{$method}) {
$c->send_error(HTTP_NOT_IMPLEMENTED); $c->send_error(HTTP_NOT_IMPLEMENTED);
@ -273,7 +283,7 @@ sub handle_requests {
} }
my $uri = $r->uri->path(); my $uri = $r->uri->path();
syslog('info', "start $method $uri"); debug_msg("start $method $uri");
my ($rel_uri, $format) = PVE::REST::split_abs_uri($uri); my ($rel_uri, $format) = PVE::REST::split_abs_uri($uri);
if (!$format) { if (!$format) {
@ -318,7 +328,7 @@ sub handle_requests {
$c->send_response($response); $c->send_response($response);
} }
syslog('info', "end $method $uri ($res->{status})"); debug_msg("end $method $uri ($res->{status})");
} }
} }
$rcount++; $rcount++;

View File

@ -31,6 +31,8 @@ $SIG{'__WARN__'} = sub {
$0 = "pvedaemon"; $0 = "pvedaemon";
PVE::APIDaemon::enable_debug() if $opt_debug;
my $cpid; my $cpid;
my $daemon; my $daemon;
eval { eval {