From: rettenbe Date: Fri, 22 Feb 2008 10:59:12 +0000 (+0000) Subject: better log messages X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2f6bb45a553dc70e39918d754f5f9010416676ea;p=gosa.git better log messages git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9061 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 91a627c56..a24275149 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -336,7 +336,7 @@ sub import_modules { if( $info ) { my ($input_address, $input_key, $input, $input_active, $input_type) = @{$info}; $known_modules->{$mod_name} = $info; - daemon_log("module $mod_name loaded", 1); + daemon_log("INFO: module $mod_name loaded", 5); } } } @@ -484,13 +484,13 @@ sub input_from_known_server { next; } my $host_key = $hit->{hostkey}; - daemon_log("SIPackages: known_server host_name: $host_name", 7); - daemon_log("SIPackages: known_server host_key: $host_key", 7); + daemon_log("DEBUG: input_from_known_server: host_name: $host_name", 7); + daemon_log("DEBUG: input_from_known_server: host_key: $host_key", 7); # check if module can open msg envelope with module key my ($tmp_msg, $tmp_msg_hash) = &check_key_and_xml_validity($input, $host_key); if( (!$tmp_msg) || (!$tmp_msg_hash) ) { - daemon_log("SIPackages: deciphering raise error", 7); + daemon_log("DEBUG: input_from_known_server: deciphering raise error", 7); daemon_log("$@", 8); next; } @@ -503,7 +503,7 @@ sub input_from_known_server { } if( (!$msg) || (!$msg_hash) || (!$module) ) { - daemon_log("Incoming message is not from a known server", 3); + daemon_log("INFO: Incoming message is not from a known server", 5); } return ($msg, $msg_hash, $module); @@ -522,14 +522,14 @@ sub input_from_known_client { next; } my $host_key = $hit->{hostkey}; - &daemon_log("SIPackages: known_client host_name: $host_name", 7); - &daemon_log("SIPackages: known_client host_key: $host_key", 7); + &daemon_log("DEBUG: input_from_known_client: host_name: $host_name", 7); + &daemon_log("DEBUG: input_from_known_client: host_key: $host_key", 7); # check if module can open msg envelope with module key ($msg, $msg_hash) = &check_key_and_xml_validity($input, $host_key); if( (!$msg) || (!$msg_hash) ) { - &daemon_log("SIPackages: deciphering raise error", 7); + &daemon_log("DEGUG: input_from_known_client: deciphering raise error", 7); &daemon_log("$@", 8); next; } @@ -540,7 +540,7 @@ sub input_from_known_client { } if( (!$msg) || (!$msg_hash) || (!$module) ) { - &daemon_log("Incoming message is not from a known client", 3); + &daemon_log("INFO: Incoming message is not from a known client", 5); } return ($msg, $msg_hash, $module); @@ -566,7 +566,7 @@ sub input_from_unknown_host { daemon_log("ERROR: no key specified in config file for $mod", 1); next; } - daemon_log("$mod: $module_key", 5); + daemon_log("DEBUG: $mod: $module_key", 7); # check if module can open msg envelope with module key ($msg, $msg_hash) = &check_key_and_xml_validity($input, $module_key); @@ -580,7 +580,7 @@ sub input_from_unknown_host { } if( (!$msg) || (!$msg_hash) || (!$module)) { - daemon_log("Incoming message is not from an unknown host", 5); + daemon_log("INFO: Incoming message is not from an unknown host", 5); } return ($msg, $msg_hash, $module); @@ -684,7 +684,7 @@ sub open_socket { if(not defined $socket) { return; } - &daemon_log("open_socket: $PeerAddr", 7); +# &daemon_log("DEBUG: open_socket: $PeerAddr", 7); return $socket; } @@ -870,8 +870,8 @@ sub client_input { my ($answer_header, @answer_target_l, $answer_source); my $client_answer; - daemon_log("Incoming msg from '".$heap->{'remote_ip'}."'", 7); - daemon_log("message:\n$input", 8); + daemon_log("INFO: Incoming msg from '".$heap->{'remote_ip'}."'", 5); + daemon_log("DEBUG: Incoming message:\n$input", 8); #################### # check incoming msg @@ -893,12 +893,12 @@ sub client_input { ###################### # process incoming msg if( $error == 0) { - daemon_log("Processing module ".$module, 5); + daemon_log("DEBUG: Processing module ".$module, 7); $answer_l = &{ $module."::process_incoming_msg" }($msg, $msg_hash, $session_id); if ( 0 > @{$answer_l} ) { my $answer_str = join("\n", @{$answer_l}); - daemon_log("$module: Got answer from module: \n".$answer_str,8); + daemon_log("DEGUB: $module: Got answer from module: \n".$answer_str,8); } } if( !$answer_l ) { $error++ }; diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index 4c136ba96..64c72c0a3 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -72,7 +72,7 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { # Read gosaUnitTag from LDAP my $tmp_ldap= Net::LDAP->new($ldap_uri); if( defined($tmp_ldap) ) { - &main::daemon_log("Searching for servers gosaUnitTag with mac address $server_mac_address",6); + &main::daemon_log("INFO: Searching for servers gosaUnitTag with mac address $server_mac_address",5); my $mesg= $tmp_ldap->bind($ldap_admin_dn, password => $ldap_admin_password); # Perform search for Unit Tag $mesg = $tmp_ldap->search( @@ -86,14 +86,14 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { my $entry= $mesg->entry(0); my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { - &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); + &main::daemon_log("INFO: Detected gosaUnitTag $unit_tag for creating entries", 5); $main::gosa_unit_tag= $unit_tag; } } else { # Perform another search for Unit Tag my $hostname= `hostname -f`; chomp($hostname); - &main::daemon_log("Searching for servers gosaUnitTag with hostname $hostname",6); + &main::daemon_log("INFO: Searching for servers gosaUnitTag with hostname $hostname",5); $mesg = $tmp_ldap->search( base => $ldap_base, scope => 'sub', @@ -104,14 +104,14 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { my $entry= $mesg->entry(0); my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { - &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); + &main::daemon_log("INFO: Detected gosaUnitTag $unit_tag for creating entries", 5); $main::gosa_unit_tag= $unit_tag; } } else { # Perform another search for Unit Tag $hostname= `hostname -s`; chomp($hostname); - &main::daemon_log("Searching for servers gosaUnitTag with hostname $hostname",6); + &main::daemon_log("INFO: Searching for servers gosaUnitTag with hostname $hostname",5); $mesg = $tmp_ldap->search( base => $ldap_base, scope => 'sub', @@ -122,17 +122,17 @@ if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { my $entry= $mesg->entry(0); my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { - &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); + &main::daemon_log("INFO: Detected gosaUnitTag $unit_tag for creating entries", 5); $main::gosa_unit_tag= $unit_tag; } } else { - &main::daemon_log("Not using gosaUnitTag", 6); + &main::daemon_log("WARNING: No gosaUnitTag detected. Not using gosaUnitTag", 3); } } } $tmp_ldap->unbind; } else { - &main::daemon_log("Using gosaUnitTag from config-file: $main::gosa_unit_tag",6); + &main::daemon_log("INFO: Using gosaUnitTag from config-file: $main::gosa_unit_tag",5); } } @@ -455,7 +455,7 @@ sub process_incoming_msg { # skip PREFIX $header =~ s/^CLMSG_//; - &main::daemon_log("SIPackages: msg to process: $header", 3); + &main::daemon_log("DEBUG: SIPackages: msg to process: $header", 7); &main::daemon_log("$msg", 8); if( 0 == length @target_l){ @@ -475,7 +475,7 @@ sub process_incoming_msg { } else { if( exists $event_hash->{$header} ) { # a event exists with the header as name - &main::daemon_log("found event '$header' at event-module '".$event_hash->{$header}."'", 5); + &main::daemon_log("INFO: found event '$header' at event-module '".$event_hash->{$header}."'", 5); no strict 'refs'; @out_msg_l = &{$event_hash->{$header}."::$header"}($msg, $msg_hash, $session_id); } @@ -489,7 +489,7 @@ sub process_incoming_msg { } } else { - &main::daemon_log("msg is not for gosa-si-server '$server_address', deliver it to target '$target'", 5); + &main::daemon_log("INFO: msg is not for gosa-si-server '$server_address', deliver it to target '$target'", 5); push(@out_msg_l, $msg); } } @@ -626,8 +626,8 @@ sub here_i_am { # number of actual activ clients my $act_nu_clients = $nu_clients; - &main::daemon_log("number of actual activ clients: $act_nu_clients", 5); - &main::daemon_log("number of maximal allowed clients: $max_clients", 5); + &main::daemon_log("INFO: number of actual activ clients: $act_nu_clients", 5); + &main::daemon_log("INFO: number of maximal allowed clients: $max_clients", 5); if($max_clients <= $act_nu_clients) { my $out_hash = &create_xml_hash("denied", $server_address, $source); @@ -679,7 +679,7 @@ sub here_i_am { &add_content2xml_hash($out_hash, "timestamp", $act_timestamp); my $new_client_out = &create_xml_string($out_hash); push(@out_msg_l, $new_client_out); - &main::daemon_log("send bus msg that client '$source' has registerd at server '$server_address'", 3); + &main::daemon_log("INFO: send bus msg that client '$source' has registerd at server '$server_address'", 5); } # give the new client his ldap config @@ -839,9 +839,9 @@ sub new_ldap_config { foreach $server (@servers){ # Conversation for backward compatibility - if ($server !=~ /^ldap[^:]+:\/\// ) { + if (not $server =~ /^ldap[^:]+:\/\// ) { if ($server =~ /^([^:]+):(.*)$/ ) { - $server= "1:dummy:ldap://$1/$2"; + $server= "1:dummy:ldap://$1/$2"; } }