       WITH UR;
 
     -- Debug
-    -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'FLAG 4 - ' || coalesce (PARENT, -1));
-
-    -- Retrieving the configured level for the parent.
-    SELECT LEVEL_ID INTO RET
-      FROM LOGDATA.CONF_LOGGERS
-      WHERE LOGGER_ID = PARENT
-      WITH UR;
-
-    IF (RET IS NULL) THEN
-
-     -- The parent could be defined, doing a recursion.
-     BEGIN
-      DECLARE STMT STATEMENT;
-      PREPARE STMT FROM 'SET ? = GET_DEFINED_PARENT_LOGGER(?)';
-      EXECUTE STMT INTO RET USING PARENT;
-     END;
+    -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'aFLAG 4 - ' || coalesce (PARENT, -1));
+
+    IF (PARENT IS NULL) THEN
+     -- The logger has not been defined in effective.
+     SET RET = GET_ROOT_OR_DEFAULT_LEVEL();
+    ELSE
+     -- Retrieving the configured level for the parent.
+     SELECT LEVEL_ID INTO RET
+       FROM LOGDATA.CONF_LOGGERS
+       WHERE LOGGER_ID = PARENT
+       WITH UR;
+
+     IF (RET IS NULL) THEN
+
+      -- The parent could be defined, doing a recursion.
+      BEGIN
+       DECLARE STMT STATEMENT;
+       PREPARE STMT FROM 'SET ? = GET_DEFINED_PARENT_LOGGER(?)';
+       EXECUTE STMT INTO RET USING PARENT;
+      END;
+     END IF;
     END IF;
    END IF;
   END IF;
 
   -- Debug
-  -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'RET - ' || coalesce (RET, -1));
+  -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'aRET - ' || coalesce (RET, -1));
 
   RETURN RET;
  END T_GET_UPPER_DEFINED @
  DECLARE EXISTS SMALLINT DEFAULT 0;

  -- Debug
  -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'FLAG 1 - ' || coalesce (SON_ID, -1));

  IF (SON_ID IS NULL OR SON_ID < 0) THEN
   SIGNAL SQLSTATE VALUE 'LG001'
     SET MESSAGE_TEXT = 'Invalid parameter';
  ELSEIF (SON_ID = 0) THEN
   -- Asking for the level for ROOT.

   -- Checks if the level is defined in Conf_loggers
   SELECT 1 INTO EXISTS
     FROM LOGDATA.CONF_LOGGERS
     WHERE LOGGER_ID = SON_ID
     WITH UR;

   -- Debug
   -- INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 5, -1, 'aFLAG 2 - ' || coalesce (EXISTS, -1));

   IF (EXISTS = 1) THEN
    -- Asking for a value different to ROOT.
