Code

log lines get new log priority
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 6 Jul 2009 15:12:48 +0000 (15:12 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 6 Jul 2009 15:12:48 +0000 (15:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13895 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/modules/ArpHandler.pm

index 1d59cd75ef7a83776f0ee1e0e48e4aed731be3cf..283eb1d664d671a2fb9ea4a09302f52353e38e45 100755 (executable)
@@ -325,6 +325,8 @@ usage: $prg [-hvf] [-c config] [-d number]
                           32 : ldap connectivity
                           64 : database status and connectivity
                          128 : main process 
+                         256 : creation of packages_list_db
+                         512 : ARP debug information
 EOF
        exit(0);
 }
@@ -996,7 +998,7 @@ sub send_msg_to_target {
             if($new_status eq "down"){
                 daemon_log("$session_id WARNING: set '$address' from status '$act_status' to '$new_status'", 3);
             } else {
-                daemon_log("$session_id INFO: set '$address' from status '$act_status' to '$new_status'", 5);
+                daemon_log("$session_id DEBUG: set '$address' from status '$act_status' to '$new_status'", 138);
             }
         }
     }
@@ -1017,7 +1019,7 @@ sub send_msg_to_target {
             if($new_status eq "down"){
                 daemon_log("$session_id WARNING: set '$address' from status '$act_status' to '$new_status'", 3);
             } else {
-                daemon_log("$session_id INFO: set '$address' from status '$act_status' to '$new_status'", 5);
+                daemon_log("$session_id DEBUG: set '$address' from status '$act_status' to '$new_status'", 138);
             }
         }
     }
@@ -1606,7 +1608,7 @@ sub process_task {
 
                 # Target of msg is a mac address
                 elsif( $answer_target =~ /^([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})$/i ) {
-                    daemon_log("$session_id INFO: target is mac address '$answer_target', looking for host in known_clients and foreign_clients", 5);
+                    daemon_log("$session_id DEBUG: target is mac address '$answer_target', looking for host in known_clients and foreign_clients", 138);
 
                     # Looking for macaddress in known_clients
                     my $sql_statement = "SELECT * FROM known_clients WHERE macaddress LIKE '$answer_target'";
@@ -3132,7 +3134,7 @@ sub parse_package_info {
     $repo_dirs{ "${repo_path}/pool" } = 1;
 
     foreach $package ("Packages.gz"){
-        daemon_log("$session_id DEBUG: create_packages_list: fetch $baseurl, $dist, $section", 7);
+        daemon_log("$session_id DEBUG: create_packages_list: fetch $baseurl, $dist, $section", 266);
         get_package( "$baseurl/dists/$dist/$section/binary-$arch/$package", "$outdir/$dist/$section", $session_id );
         parse_package( "$outdir/$dist/$section", $dist, $path, $session_id );
     }
@@ -3150,9 +3152,9 @@ sub get_package {
     # This is ugly, but I've no time to take a look at "how it works in perl"
     if(0 == system("wget '$url' -O '$dest' 2>/dev/null") ) {
         system("gunzip -cd '$dest' > '$dest.in'");
-        daemon_log("$session_id DEBUG: run command: gunzip -cd '$dest' > '$dest.in'", 7);
+        daemon_log("$session_id DEBUG: run command: gunzip -cd '$dest' > '$dest.in'", 266);
         unlink($dest);
-        daemon_log("$session_id DEBUG: delete file '$dest'", 7); 
+        daemon_log("$session_id DEBUG: delete file '$dest'", 266); 
     } else {
         daemon_log("$session_id ERROR: create_packages_list_db: get_packages: fetching '$url' into '$dest' failed!", 1);
     }
@@ -3259,7 +3261,7 @@ sub cleanup_and_extract {
 
                if( -f "$dir/DEBIAN/templates" ) {
 
-                       daemon_log("0 DEBUG: Found debconf templates in '$package' - $newver", 7);
+                       daemon_log("0 DEBUG: Found debconf templates in '$package' - $newver", 266);
 
                        my $tmpl= ""; {
                                local $/=undef;
index 144d72b55ac6824ce21db12a3311ddb562f8f5d0..7f7ad2297d9f895919b781adfb000248974f69ce 100644 (file)
@@ -195,11 +195,11 @@ sub got_packet {
                                cn => (($dnsname =~ /^(\d){1,3}\.(\d){1,3}\.(\d){1,3}\.(\d){1,3}/) ? $dnsname : sprintf "%s", $dnsname =~ /([^\.]+)\./),
                                macVendor => (($lookup_vendor) ? &get_vendor_for_mac($packet->{source_haddr}) : "Unknown Vendor"),
                        };
-                       &main::daemon_log("Host was not found in LDAP (".($hosts_database->{$packet->{source_haddr}}->{dnsname}).")",6);
+                       &main::daemon_log("A DEBUG: Host was not found in LDAP (".($hosts_database->{$packet->{source_haddr}}->{dnsname}).")",522);
                        &main::daemon_log(
-                               "New Host ".($hosts_database->{$packet->{source_haddr}}->{dnsname}).
+                               "A INFO: New Host ".($hosts_database->{$packet->{source_haddr}}->{dnsname}).
                                ": ".$hosts_database->{$packet->{source_haddr}}->{ipHostNumber}.
-                               "/".$hosts_database->{$packet->{source_haddr}}->{macAddress},4);
+                               "/".$hosts_database->{$packet->{source_haddr}}->{macAddress},5);
                        &add_ldap_entry(
                                $ldap_handle, 
                                $ldap_base, 
@@ -213,9 +213,9 @@ sub got_packet {
        } else {
                if(($arp_update eq "true") and !($hosts_database->{$packet->{source_haddr}}->{ipHostNumber} eq $packet->{source_ipaddr})) {
                        &main::daemon_log(
-                               "IP Address change of MAC ".$packet->{source_haddr}.
+                               "A INFO: IP Address change of MAC ".$packet->{source_haddr}.
                                ": ".$hosts_database->{$packet->{source_haddr}}->{ipHostNumber}.
-                               "->".$packet->{source_ipaddr}, 4);
+                               "->".$packet->{source_ipaddr}, 5);
                        $hosts_database->{$packet->{source_haddr}}->{ipHostNumber}= $packet->{source_ipaddr};
                        &change_ldap_entry(
                                $ldap_handle, 
@@ -311,7 +311,7 @@ sub get_vendor_for_mac {
                if(length($vendor) > 0) {
                        $result= @{$vendor}[0];
                }
-               &main::daemon_log("Looking up Vendor for MAC ".$mac.": $result", 4);
+               &main::daemon_log("A INFO: Looking up Vendor for MAC ".$mac.": $result", 5);
        }
 
        return $result;
@@ -334,10 +334,10 @@ sub add_ldap_entry {
                my $s_res = &search_ldap_entry($ldap_tree, $ldap_base, "(|(macAddress=$mac)(dhcpHWAddress=ethernet $mac))");
                my $c_res = (defined($s_res))?$s_res->count:0;
                if($c_res == 1) {
-                       &main::daemon_log("WARNING: macAddress $mac already in LDAP", 1);
+                       &main::daemon_log("A WARNING: macAddress $mac already in LDAP", 3);
                        return;
                } elsif($c_res > 0) {
-                       &main::daemon_log("ERROR: macAddress $mac exists $c_res times in LDAP", 1);
+                       &main::daemon_log("ERROR: macAddress $mac exists $c_res times in LDAP", 1);
                        return;
                }
 
@@ -357,14 +357,14 @@ sub add_ldap_entry {
 
                # for $result->code constants please look at Net::LDAP::Constant
                if($result->code == 68) {   # entry already exists 
-                       &main::daemon_log("WARNING: $dn ".$result->error, 3);
+                       &main::daemon_log("WARNING: $dn ".$result->error, 3);
                } elsif($result->code == 0) {   # everything went fine
                        &main::daemon_log("add entry $dn to ldap", 1);
                } else {  # if any other error occur
-                       &main::daemon_log("ERROR: $dn, ".$result->code.", ".$result->error, 1);
+                       &main::daemon_log("ERROR: $dn, ".$result->code.", ".$result->error, 1);
                }
        } else {
-               &main::daemon_log("Not adding new Entry: LDAP disabled", 6);
+               &main::daemon_log("Not adding new Entry: LDAP disabled", 6);
        }
        return;
 }