diff --git a/html/index.php b/html/index.php
index 23d27d5dfdc6443e77b4880b06ec3bfb3873bdbe..151a88567626b2508ec5babf24836e8f2b0d12e8 100644
--- a/html/index.php
+++ b/html/index.php
@@ -105,7 +105,7 @@ if (!is_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
 $config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
 session::set('config', $config);
 session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
-@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
+logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
 /* Configuration was reloaded, so plist needs to be as well */
 session::un_set('plist');
 unset($plist);
diff --git a/html/main.php b/html/main.php
index d4f72e449832c922346eb8f1aaa3d1b4f757bbfc..0772eebdbe8cb300771740300a803c908910d7de 100644
--- a/html/main.php
+++ b/html/main.php
@@ -40,9 +40,9 @@ session::start();
 reset_errors();
 
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-  @DEBUG(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, '_POST');
+  logging::debug(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, '_POST');
 }
-@DEBUG(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, $_SESSION, '_SESSION');
+logging::debug(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, $_SESSION, '_SESSION');
 
 /* Logged in? Simple security check */
 if (!session::is_set('connected')) {
@@ -86,7 +86,7 @@ if (session::get('_LAST_PAGE_REQUEST') != '') {
 session::set('_LAST_PAGE_REQUEST', time());
 
 
-@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
+logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
 
 /* Set template compile directory */
 $smarty->compile_dir = $config->get_cfg_value("templateCompileDirectory", SPOOL_DIR);
@@ -109,14 +109,14 @@ $smarty->assign('hideMenus', FALSE);
 /* check user expiration status */
 $expired = $ui->expired_status();
 if (($expired == POSIX_WARN_ABOUT_EXPIRATION) && !session::is_set('POSIX_WARN_ABOUT_EXPIRATION__DONE')) {
-  @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
+  logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
 
   // The users password is about to expire soon, display a warning message.
   logging::log('security', 'fusiondirectory', '', [], 'password for user "'.$ui->uid.'" is about to expire');
   msg_dialog::display(_('Password change'), _('Your password is about to expire, please change your password!'), INFO_DIALOG);
   session::set('POSIX_WARN_ABOUT_EXPIRATION__DONE', TRUE);
 } elseif ($expired == POSIX_FORCE_PASSWORD_CHANGE) {
-  @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account expired');
+  logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account expired');
 
   // The password is expired, we are now going to enforce a new one from the user.
 
diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc
index 4911927b8d796714a9cd59a71b98fbfd25c70c24..8667de4a4c9a1e83e949f237c1178af732cd0930 100644
--- a/include/class_CopyPasteHandler.inc
+++ b/include/class_CopyPasteHandler.inc
@@ -72,7 +72,7 @@ class CopyPasteHandler
    */
   function add_to_queue ($dn, $action, $type)
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'add_to_queue');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'add_to_queue');
 
     if (!in_array($action, ['cut','copy'])) {
       trigger_error(sprintf('Specified action "%s" does not exists for copy & paste.', $action));
@@ -136,7 +136,7 @@ class CopyPasteHandler
    */
   protected function load_entry_from_ldap ($entry)
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap');
     if (!isset($entry['tab_class']) && !isset($entry['type'])) {
       return [];
     }
diff --git a/include/class_Language.inc b/include/class_Language.inc
index c7afdb7e39fcd7580b4c3a751ee0b977c9341eb2..6bdaa11acc1bfaebf9d4738fb1276178ff965409 100644
--- a/include/class_Language.inc
+++ b/include/class_Language.inc
@@ -60,7 +60,7 @@ class Language
     bindtextdomain($domain, LOCALE_DIR);
     textdomain($domain);
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, 'Setting language to');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, 'Setting language to');
     }
 
     $ret = FALSE;
@@ -70,7 +70,7 @@ class Language
       $ret = TRUE;
       if (session::is_set('plist')) {
         if ($_SERVER['REQUEST_METHOD'] != 'POST') {
-          @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get('lang'), 'Plist already loaded with language');
+          logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get('lang'), 'Plist already loaded with language');
         }
         session::un_set('plist');
         session::set('lang', $lang);
diff --git a/include/class_config.inc b/include/class_config.inc
index 59b652606f7ce1ee31715246697cac4a225b9580..cbae9d07ffcc34f56887bece3253eb9105a9497e 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -965,7 +965,7 @@ class config
             if (($tabclass == 'GROUPTABS') && class_available('mixedGroup')) {
               $tabclass = 'OGROUP-USERTABS';
             }
-            @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class to tab list");
+            logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class to tab list");
             if (!isset($this->data['TABS'][$tabclass])) {
               $this->data['TABS'][$tabclass] = [];
             }
@@ -1007,7 +1007,7 @@ class config
               $value['tabClass'] = 'simpleTabs';
             }
             $this->data['OBJECTS'][strtoupper($key)] = $value;
-            @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class as main tab of");
+            logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $tabclass, "Adding $class as main tab of");
             if (!isset($this->data['TABS'][$tabclass])) {
               $this->data['TABS'][$tabclass] = [];
             }
@@ -1015,7 +1015,7 @@ class config
           }
         }
       } elseif (class_available($class) && is_subclass_of($class, 'simpleService')) {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, "Adding service");
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, "Adding service");
         if (!isset($this->data['TABS']['SERVERSERVICE'])) {
           $this->data['TABS']['SERVERSERVICE'] = [];
         }
@@ -1057,7 +1057,7 @@ class config
     ];
     /* Extract categories definitions from object types */
     foreach ($this->data['OBJECTS'] as $key => $infos) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['aclCategory'], "ObjectType $key category");
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['aclCategory'], "ObjectType $key category");
       if (strtoupper($infos['aclCategory']) == $key) {
         $cat = $infos['aclCategory'];
         if (!isset($this->data['CATEGORIES'][$cat])) {
@@ -1135,7 +1135,7 @@ class config
           }
         }
       }
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
       /* Feed menu */
       if (isset($plInfo['plSection'])) {
         $section = $plInfo['plSection'];
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index be0a4988f6b68b441fe0a9be3329689b541b40fe..1ac53137d9b798847175ad7700b18b20537dfdeb 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -221,7 +221,7 @@ class LDAP
       $this->error = 'Could not connect to LDAP server';
     }
 
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'connect');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'connect');
   }
 
   /*!
@@ -234,11 +234,11 @@ class LDAP
       $this->error      = "Success";
       $this->hascon     = TRUE;
       $this->reconnect  = TRUE;
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rebind');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rebind');
       return 0;
     } else {
       $this->error = "Could not bind to " . $credentials['ADMINDN'];
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rebind');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rebind');
       return NULL;
     }
   }
@@ -260,7 +260,7 @@ class LDAP
   {
     @ldap_unbind($this->cid);
     $this->cid = NULL;
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'unbind');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'unbind');
   }
 
   /*!
@@ -272,7 +272,7 @@ class LDAP
       @ldap_close($this->cid);
       $this->hascon = FALSE;
     }
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'disconnect');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'disconnect');
   }
 
   /*!
@@ -359,11 +359,11 @@ class LDAP
       }
 
       $this->log("LDAP operation: time=".$diff." operation=search('".$this->basedn."', '$filter')");
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'search(base="'.$this->basedn.'",scope="'.$scope.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'search(base="'.$this->basedn.'",scope="'.$scope.'",filter="'.$filter.'")');
       return $this->sr[$srp];
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'search(base="'.$this->basedn.'",scope="'.$scope.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'search(base="'.$this->basedn.'",scope="'.$scope.'",filter="'.$filter.'")');
       return "";
     }
   }
@@ -428,11 +428,11 @@ class LDAP
       $this->error    = @ldap_error($this->cid);
       $this->resetResult($srp);
       $this->hasres[$srp] = TRUE;
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'cat(dn="'.$dn.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'cat(dn="'.$dn.'",filter="'.$filter.'")');
       return $this->sr[$srp];
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'cat(dn="'.$dn.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'cat(dn="'.$dn.'",filter="'.$filter.'")');
       return "";
     }
   }
@@ -451,11 +451,11 @@ class LDAP
         $this->connect();
       }
       $res  = @ldap_read($this->cid, $dn, $filter, ["objectClass"]);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'object_match_filter(dn="'.$dn.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'object_match_filter(dn="'.$dn.'",filter="'.$filter.'")');
       return @ldap_count_entries($this->cid, $res);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'object_match_filter(dn="'.$dn.'",filter="'.$filter.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'object_match_filter(dn="'.$dn.'",filter="'.$filter.'")');
       return FALSE;
     }
   }
@@ -476,7 +476,7 @@ class LDAP
     } else {
       $this->error = "Could not connect to LDAP server";
     }
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $size, 'set_size_limit');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $size, 'set_size_limit');
   }
 
   /*!
@@ -507,16 +507,16 @@ class LDAP
         if (!isset($att)) {
           $att = [];
         }
-        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
+        logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
         return $att;
       } else {
         $this->error = "Perform a fetch with no search";
-        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
+        logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
         return "";
       }
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'fetch()');
       return "";
     }
   }
@@ -582,16 +582,16 @@ class LDAP
       if ($this->hasres[$srp]) {
         $rv = @ldap_count_entries($this->cid, $this->sr[$srp]);
         $this->error = @ldap_error($this->cid);
-        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
+        logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
         return $rv;
       } else {
         $this->error = "Perform a Fetch with no Search";
-        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
+        logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
         return "";
       }
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'count()');
       return "";
     }
   }
@@ -616,11 +616,11 @@ class LDAP
 
       $r = ldap_mod_del($this->cid, $dn, $attrs);
       $this->error = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rm('.$dn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rm('.$dn.')');
       return $r;
     } else {
       $this->error = 'Could not connect to LDAP server';
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rm('.$dn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rm('.$dn.')');
       return '';
     }
   }
@@ -637,11 +637,11 @@ class LDAP
 
       $r = @ldap_mod_add($this->cid, $dn, $attrs);
       $this->error = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'mod_add('.$dn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'mod_add('.$dn.')');
       return $r;
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'mod_add('.$dn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'mod_add('.$dn.')');
       return "";
     }
   }
@@ -659,11 +659,11 @@ class LDAP
       }
       $r = @ldap_delete($this->cid, $deletedn);
       $this->error = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
       return ($r ? $r : 0);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir('.$deletedn.')');
       return "";
     }
   }
@@ -713,11 +713,11 @@ class LDAP
       /* Check if destination dn exists, if not the
           server may not support this operation */
       $r &= is_resource($this->dn_exists($dest));
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
       return $r;
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rename("'.$source.'","'.$dest.'")');
       return FALSE;
     }
   }
@@ -759,11 +759,11 @@ class LDAP
         }
       }
       $this->error = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir_recursive("'.$deletedn.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir_recursive("'.$deletedn.'")');
       return ($r ? $r : 0);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir_recursive("'.$deletedn.'")');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'rmdir_recursive("'.$deletedn.'")');
       return "";
     }
   }
@@ -789,7 +789,7 @@ class LDAP
       $str = " - <b>attribute: ".preg_replace("/:.*$/", "", $this->get_additional_error())."</b>";
     }
 
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs, "Erroneous data");
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs, "Erroneous data");
 
     return $str;
   }
@@ -813,11 +813,11 @@ class LDAP
       if (!$this->success()) {
         $this->error .= $this->makeReadableErrors($this->error, $attrs);
       }
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify('.$this->basedn.')');
       return ($r ? $r : 0);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify('.$this->basedn.')');
       return "";
     }
   }
@@ -838,11 +838,11 @@ class LDAP
       }
       $r            = @ldap_modify_batch($this->cid, $this->basedn, $changes);
       $this->error  = @ldap_error($this->cid);
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify_batch('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify_batch('.$this->basedn.')');
       return $r;
     } else {
       $this->error = 'Could not connect to LDAP server';
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify_batch('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'modify_batch('.$this->basedn.')');
       return FALSE;
     }
   }
@@ -863,11 +863,11 @@ class LDAP
       if (!$this->success()) {
         $this->error .= $this->makeReadableErrors($this->error, $attrs);
       }
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'add('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'add('.$this->basedn.')');
       return ($r ? $r : 0);
     } else {
       $this->error = "Could not connect to LDAP server";
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'add('.$this->basedn.')');
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->error, 'add('.$this->basedn.')');
       return "";
     }
   }
@@ -987,9 +987,9 @@ class LDAP
         $this->add($na);
 
         if (!$this->success()) {
-          @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $cdn, 'dn');
-          @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $na, 'Content');
-          @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error(), 'LDAP error');
+          logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $cdn, 'dn');
+          logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $na, 'Content');
+          logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error(), 'LDAP error');
 
           msg_dialog::display(_('LDAP error'), msgPool::ldaperror($this->get_error(), $cdn, LDAP_ADD, get_class()), LDAP_ERROR);
           return FALSE;
@@ -1161,7 +1161,7 @@ class LDAP
 
   function dn_exists ($dn)
   {
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'dn_exists('.$dn.')');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, '', 'dn_exists('.$dn.')');
     return @ldap_read($this->cid, $dn, "(objectClass=*)", ["objectClass"]);
   }
 
@@ -1518,7 +1518,7 @@ class LDAP
     $res    = @ldap_read($ds, '', 'objectClass=*', ['namingContexts']);
     $attrs  = @ldap_get_entries($ds, $res);
 
-    @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs[0]['namingcontexts'], 'get_naming_contexts');
+    logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs[0]['namingcontexts'], 'get_naming_contexts');
     return $attrs[0]['namingcontexts'];
   }
 }
diff --git a/include/class_objects.inc b/include/class_objects.inc
index 55d8c6d81aa70c293944dcd7137ecdab75a6ba8a..09a66b15f78e617f35abc6db4ea2e7cd7aecd20f 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -338,7 +338,7 @@ class objects
     $tabClass = $infos['tabClass'];
 
     $tabObject = new $tabClass($type, $dn);
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Openned as $type object");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Openned as $type object");
 
     return $tabObject;
   }
@@ -406,7 +406,7 @@ class objects
     $attrsObject->is_template = TRUE;
 
     $tabObject = new $tabClass($type, 'new', $attrsObject);
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Create template of $type");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Create template of $type");
 
     return $tabObject;
   }
diff --git a/include/class_passwordRecovery.inc b/include/class_passwordRecovery.inc
index 887b9d73a731ecb64282cda68b5ae2192620aea4..5b5955d077a32948df072f1c766d235e562291e3 100644
--- a/include/class_passwordRecovery.inc
+++ b/include/class_passwordRecovery.inc
@@ -110,7 +110,7 @@ class passwordRecovery extends standAlonePage
       msg_dialog::displayChecks($this->message);
     }
 
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->step, "Step");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->step, "Step");
 
     $smarty = get_smarty();
 
@@ -149,7 +149,7 @@ class passwordRecovery extends standAlonePage
 
     $this->loginAttribute = $config->get_cfg_value('passwordRecoveryLoginAttribute', 'uid');
 
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated");
     return ($config->get_cfg_value('passwordRecoveryActivated') == "TRUE");
   }
 
@@ -341,7 +341,7 @@ class passwordRecovery extends standAlonePage
     $reinit_link .= '&login='.urlencode($this->login);
     $reinit_link .= '&email_address='.urlencode($this->email_address);
 
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $reinit_link, 'Setting link to');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $reinit_link, 'Setting link to');
 
     /* Send the mail */
     $body = sprintf($this->mail_body, $this->login, $reinit_link);
diff --git a/include/class_standAlonePage.inc b/include/class_standAlonePage.inc
index a1b597437f1696a4105411b737ac266c8f257ffa..57e3771495391929a0c2b5faab3a8ce551639a11 100644
--- a/include/class_standAlonePage.inc
+++ b/include/class_standAlonePage.inc
@@ -129,7 +129,7 @@ class standAlonePage
     /* Parse configuration file */
     $config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
     session::set('DEBUGLEVEL', $config->get_cfg_value('debuglevel'));
-    @DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
+    logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
     return $config;
   }
 
diff --git a/include/functions.inc b/include/functions.inc
index 1da038c4851e95e8681bf1b7942505a8f37cb95c..4a97774bf39783c67b11484cc269bed10903c587 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -100,7 +100,7 @@ function __fusiondirectory_autoload ($class_name)
   if (isset($class_mapping["$class_name"])) {
     require_once($BASE_DIR.'/'.$class_mapping["$class_name"]);
   } else {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class_name, 'Could not load');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class_name, 'Could not load');
     if (isset($config) && is_object($config) &&
         $config->get_cfg_value('displayerrors') == 'TRUE') {
       list($trace, ) = html_trace();
diff --git a/include/management/class_management.inc b/include/management/class_management.inc
index 9a344c7982de55240c02edbe33c882f5f0cb445c..1ac9495bfd46d5047c6b75dab6e09c2d24d0a8cb 100644
--- a/include/management/class_management.inc
+++ b/include/management/class_management.inc
@@ -440,7 +440,7 @@ class management
     // Handle actions (POSTs and GETs)
     $action = $this->detectPostActions();
     if (!empty($action['action'])) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Action');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Action');
       try {
         $str = $this->handleAction($action);
         if (!empty($str)) {
@@ -670,7 +670,7 @@ class management
       return;
     } else {
       if (!$cancel) {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Template applied!');
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Template applied!');
       }
       del_lock($this->currentDn);
       if (empty($this->currentDns)) {
@@ -711,7 +711,7 @@ class management
 
     // Open object
     $this->openTabObject(objects::create($type));
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create entry initiated');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create entry initiated');
   }
 
   function newEntryTemplate (array $action)
@@ -725,7 +725,7 @@ class management
 
     // Open object
     $this->openTabObject(objects::createTemplate($type));
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
   }
 
   function newEntryFromTemplate (array $action)
@@ -834,7 +834,7 @@ class management
 
     // Open object
     $this->openTabObject(objects::open($this->currentDn, $entry->getTemplatedType()));
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Edit entry initiated');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Edit entry initiated');
     if (isset($action['subaction'])
       && ($this->handleSubAction($action) === FALSE)) {
       trigger_error('Was not able to handle subaction: '.$action['subaction']);
@@ -874,7 +874,7 @@ class management
         msg_dialog::displayChecks($msgs);
         return;
       } else {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry saved');
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry saved');
         $this->remove_lock();
         $this->closeDialogs();
       }
@@ -892,7 +892,7 @@ class management
       if (count($msgs)) {
         msg_dialog::displayChecks($msgs);
       } else {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Modifications applied');
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Modifications applied');
         $this->tabObject->re_init();
         /* Avoid applying the POST a second time */
         $_POST = [];
@@ -909,7 +909,7 @@ class management
     $disallowed       = [];
     $this->currentDns = [];
 
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Entry deletion requested');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Entry deletion requested');
 
     // Check permissons for each target
     foreach ($action['targets'] as $dn) {
@@ -973,7 +973,7 @@ class management
   function removeConfirmed (array $action)
   {
     global $ui;
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry deletion confirmed');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns, 'Entry deletion confirmed');
 
     foreach ($this->currentDns as $dn) {
       $entry = $this->listing->getEntry($dn);
@@ -1028,11 +1028,11 @@ class management
         $entry = $this->listing->getEntry($dn);
         if (($action['action'] == 'copy') && $entry->checkAcl('r')) {
           $this->cpHandler->add_to_queue($dn, 'copy', $entry->getTemplatedType());
-          @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry copied!');
+          logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry copied!');
         }
         if (($action['action'] == 'cut') && $entry->checkAcl('rd')) {
           $this->cpHandler->add_to_queue($dn, 'cut', $entry->getTemplatedType());
-          @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry cut!');
+          logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Entry cut!');
         }
       }
     }
@@ -1065,7 +1065,7 @@ class management
   function createSnapshotDialog (array $action)
   {
     global $config, $ui;
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Snapshot creation initiated!');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action['targets'], 'Snapshot creation initiated!');
 
     $this->currentDn = array_pop($action['targets']);
     if (empty($this->currentDn)) {
@@ -1102,7 +1102,7 @@ class management
     }
 
     if ($ui->allow_snapshot_restore($this->currentDn, $aclCategories, empty($action['targets']))) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Snapshot restoring initiated!');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Snapshot restoring initiated!');
       $this->dialogObject = new SnapshotRestoreDialog($this->currentDn, $this, empty($action['targets']), $aclCategories);
     } else {
       msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->currentDn),
@@ -1192,7 +1192,7 @@ class management
     $entry = $this->listing->getEntry($dn);
     if ($entry->snapshotCreationAllowed()) {
       $this->snapHandler->createSnapshot($dn, $description, $entry->type);
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot created!');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot created!');
     } else {
       msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $dn),
           ERROR_DIALOG);
@@ -1209,7 +1209,7 @@ class management
     global $ui;
     if (!empty($dn) && $ui->allow_snapshot_restore($dn, $this->dialogObject->aclCategory, $this->dialogObject->global)) {
       $dn = $this->snapHandler->restoreSnapshot($dn);
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot restored');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot restored');
       $this->closeDialogs();
       if ($dn !== FALSE) {
         $this->listing->focusDn($dn);
@@ -1237,7 +1237,7 @@ class management
     global $ui;
     if (!empty($dn) && $ui->allow_snapshot_delete($dn, $this->dialogObject->aclCategory)) {
       $this->snapHandler->removeSnapshot($dn);
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot deleted');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot deleted');
     } else {
       msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to delete a snapshot for %s.'), $dn),
           ERROR_DIALOG);
diff --git a/include/management/columns/class_PropertiesColumn.inc b/include/management/columns/class_PropertiesColumn.inc
index 9e5fde8820e1028530633ee732e473897d39cba4..8f3d2ddccfbefbfaba526eb7ac6c75dcff6a6134 100644
--- a/include/management/columns/class_PropertiesColumn.inc
+++ b/include/management/columns/class_PropertiesColumn.inc
@@ -144,7 +144,7 @@ class PropertiesColumn extends Column
               'tab'   => $class,
             ];
           } else {
-            @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $pInfos['plShortName']." ($class)", 'No icon for');
+            logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $pInfos['plShortName']." ($class)", 'No icon for');
           }
         } else {
           $icons[] = [
diff --git a/include/management/snapshot/class_SnapshotHandler.inc b/include/management/snapshot/class_SnapshotHandler.inc
index 9b511b0188997fc9bfa8562dcc4c2e0978b0682d..ef1ac22b6b7b76f05480012619649fbc1ac39908 100644
--- a/include/management/snapshot/class_SnapshotHandler.inc
+++ b/include/management/snapshot/class_SnapshotHandler.inc
@@ -199,7 +199,7 @@ class SnapshotHandler
   {
     global $config;
     if (!$this->enabled()) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to create snapshot');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to create snapshot');
       return;
     }
 
@@ -214,7 +214,7 @@ class SnapshotHandler
 
     /* check if the dn exists */
     if (!$ldap->dn_exists($dn)) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Tried to snapshot non-existing dn');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Tried to snapshot non-existing dn');
       return;
     }
 
@@ -376,7 +376,7 @@ class SnapshotHandler
   {
     global $config;
     if (!$this->enabled()) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to restore snapshot');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snapshot are disabled but tried to restore snapshot');
       return FALSE;
     }
 
diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc
index f67dee1535bc44eb384ed00be75e45eddb208616..19d3c41ec5f995d952dd194e6d0d44d0ad0b05d8 100644
--- a/include/simpleplugin/class_simplePlugin.inc
+++ b/include/simpleplugin/class_simplePlugin.inc
@@ -246,7 +246,7 @@ class simplePlugin implements SimpleTab
 
       /* Set the template flag according to the existence of objectClass fdTemplate */
       if (isset($this->attrs['objectClass']) && in_array_ics('fdTemplate', $this->attrs['objectClass'])) {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, 'found', 'Template check');
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, 'found', 'Template check');
         $this->setTemplate(TRUE);
         $this->templateLoadAttrs($this->attrs);
       }
@@ -254,7 +254,7 @@ class simplePlugin implements SimpleTab
       /* Is Account? */
       if ($this->is_this_account($this->attrs)) {
         $this->is_account = TRUE;
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, get_class($this), 'Tab active');
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, get_class($this), 'Tab active');
       }
     }
 
@@ -592,7 +592,7 @@ class simplePlugin implements SimpleTab
     $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dst_dn));
     if (!$ldap->rename_dn($src_dn, $dst_dn)) {
       logging::log('error', 'ldap', "FROM: $src_dn -- TO: $dst_dn", [], 'Ldap Protocol v3 implementation error, ldap_rename failed: '.$ldap->get_error());
-      @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, "Rename failed FROM: $src_dn  -- TO:  $dst_dn",
+      logging::debug(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, "Rename failed FROM: $src_dn  -- TO:  $dst_dn",
         'Ldap Protocol v3 implementation error. Error:'.$ldap->get_error());
       return $ldap->get_error();
     }
@@ -647,7 +647,7 @@ class simplePlugin implements SimpleTab
    */
   function execute (): string
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "execute");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "execute");
 
     /* Reset Lock message POST/GET check array, to prevent preg_match errors */
     session::set('LOCK_VARS_TO_USE', []);
@@ -1125,7 +1125,7 @@ class simplePlugin implements SimpleTab
    */
   function save_object ()
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'save_object');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'save_object');
     if ($this->displayHeader && isset($_POST[get_class($this).'_modify_state'])) {
       if ($this->is_account && $this->acl_is_removeable()) {
         $this->is_account = FALSE;
@@ -1243,7 +1243,7 @@ class simplePlugin implements SimpleTab
    */
   function save (): array
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "save");
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "save");
     $errors = $this->prepare_save();
     if (!empty($errors)) {
       return $errors;
@@ -1515,14 +1515,14 @@ class simplePlugin implements SimpleTab
 
       $command = templateHandling::parseString($command, $addAttrs, 'escapeshellarg');
 
-      @DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execute');
+      logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execute');
       exec($command, $arr, $returnCode);
       $returnOutput = $arr;
 
       if ($returnCode != 0) {
         $str = implode("\n", $arr);
-        @DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execution failed code: '.$returnCode);
-        @DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
+        logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Execution failed code: '.$returnCode);
+        logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
         $message = msgPool::cmdexecfailed($cmd, '', get_class($this));
         $message .= '<br/><br/>'."\n";
         $message .= 'Exit code: '.$returnCode.'<br/>'."\n";
@@ -1532,7 +1532,7 @@ class simplePlugin implements SimpleTab
         $messages[] = $message;
       } elseif (is_array($arr)) {
         $str = implode("\n", $arr);
-        @DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
+        logging::debug(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, 'Output: '.$str);
         if (!empty($str) && $config->get_cfg_value('displayHookOutput', 'FALSE') == 'TRUE') {
           msg_dialog::display('['.get_class($this).' '.strtolower($cmd).'trigger] '.$command, $str, INFO_DIALOG);
         }
@@ -1545,7 +1545,7 @@ class simplePlugin implements SimpleTab
    */
   function check (): array
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'check');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'check');
     $messages = [];
 
     foreach ($this->attributesInfo as $sectionInfo) {
diff --git a/include/simpleplugin/class_simpleTabs.inc b/include/simpleplugin/class_simpleTabs.inc
index 093bb19a6b1bb034be28796f10c4d913f4b96f00..f02ba47f14b03a8f38859c51ca043f9e2548bf3d 100644
--- a/include/simpleplugin/class_simpleTabs.inc
+++ b/include/simpleplugin/class_simpleTabs.inc
@@ -162,11 +162,11 @@ class simpleTabs
     global $ui;
     $baseobject = $this->getBaseObject();
     if (isset($baseobject->base)) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixing base');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixing base');
       $baseobject->base = $ui->getCurrentBase();
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixed base');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $baseobject->base, 'Fixed base');
     } else {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, '', 'no base');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, '', 'no base');
     }
   }
 
@@ -224,7 +224,7 @@ class simpleTabs
 
     /* Save last tab */
     if ($this->last != "") {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->last, "Saving");
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->last, "Saving");
 
       $this->by_object[$this->last]->save_object();
     }
@@ -349,7 +349,7 @@ class simpleTabs
     foreach ($this->by_object as $key => $obj) {
       $this->plNotify[$key] = FALSE;
       if (($obj->is_account || $obj->ignore_account) && (!$obj->is_template)) {
-        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Checking");
+        logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Checking");
 
         $msg = $obj->check();
 
@@ -384,7 +384,7 @@ class simpleTabs
     $old_dn     = $this->dn;
     try {
       $new_dn     = $baseobject->compute_dn();
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $new_dn, 'Saving');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $new_dn, 'Saving');
     } catch (FusionDirectoryException $e) {
       return [
         sprintf(_('Failed to compute DN for object: %s'), $e->getMessage())
@@ -413,7 +413,7 @@ class simpleTabs
     /* Save all plugins */
     $first = TRUE;
     foreach ($this->by_object as $key => $obj) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, 'Saving');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, 'Saving');
 
       $obj->dn = $this->dn;
 
@@ -460,7 +460,7 @@ class simpleTabs
   function adapt_from_template ($attrs, $skip = [])
   {
     foreach ($this->by_object as $key => &$obj) {
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Adapting");
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Adapting");
       $obj->parent = &$this;
       $obj->adapt_from_template($attrs, $skip);
     }
diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc
index f774ce2524565e20716c27bdfadadd89292e6888..783d8250137d879cb3d88a397e4b697cec8ed7e5 100644
--- a/plugins/admin/acl/class_aclManagement.inc
+++ b/plugins/admin/acl/class_aclManagement.inc
@@ -188,7 +188,7 @@ class aclManagement extends management
     $this->currentDn        = $dn;
 
     $this->openTabObject($tabObject);
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Creating new ACL assignment');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Creating new ACL assignment');
   }
 
   /*! \brief Display confirmation dialog
diff --git a/plugins/admin/groups/tabs_ogroups.inc b/plugins/admin/groups/tabs_ogroups.inc
index ca4ccd73d217ea38daa8667194da92329ad8e708..b36091737f998b64d5f0bab92e33fcadf5384812 100644
--- a/plugins/admin/groups/tabs_ogroups.inc
+++ b/plugins/admin/groups/tabs_ogroups.inc
@@ -109,7 +109,7 @@ class ogrouptabs extends simpleTabs_noSpecial
 
   function addTab ($class)
   {
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, 'Adding tab ');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $class, 'Adding tab ');
     $plInfos = pluglist::pluginInfos($class);
     $this->by_name[$class]  = $plInfos['plShortName'];
     $this->plNotify[$class] = FALSE;
@@ -162,7 +162,7 @@ class ogrouptabs extends simpleTabs_noSpecial
       if (isset($this->by_object[$key])) {
         continue;
       }
-      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, 'Removing');
+      logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, 'Removing');
 
       $obj->dn = $this->dn;
       $tabErrors = $obj->remove(FALSE);
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 684499d5876c4e59d9260fd62119134d1aa8215a..52ac840770b28cc8cb79617cd825ed7704767c4a 100644
--- a/plugins/admin/users/class_userManagement.inc
+++ b/plugins/admin/users/class_userManagement.inc
@@ -69,7 +69,7 @@ class userManagement extends management
   function lockUsers (array $action)
   {
     global $config, $ui;
-    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Lock');
+    logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action, 'Lock');
 
     // Filter out entries we are not allowed to modify
     $disallowed = [];