 END IF;
 COMMIT;
 
+-- TODO Test39: Update the level of ROOT logger, value from conf.
+INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test39: Update the level of ROOT logger, value from conf');
+SET EXPECTED_LOGGER = 0;
+SET EXPECTED_PARENT = NULL;
+SET EXPECTED_LEVEL = 2;
+DELETE FROM LOGDATA.CONF_LOGGERS;
+INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
+  VALUES (EXPECTED_LOGGER, 'ROOT', EXPECTED_PARENT, EXPECTED_LEVEL);
+UPDATE LOGDATA.CONF_LOGGERS_EFFECTIVE
+  SET LEVEL_ID = EXPECTED_LEVEL
+  WHERE LOGGER_ID = EXPECTED_LOGGER;
+SELECT LOGGER_ID, PARENT_ID, LEVEL_ID INTO ACTUAL_LOGGER, ACTUAL_PARENT, ACTUAL_LEVEL
+  FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
+  WHERE LOGGER_ID = 0;
+IF (EXPECTED_LOGGER <> ACTUAL_LOGGER) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LOGGER_ID ' || EXPECTED_LOGGER || ' - ' || ACTUAL_LOGGER);
+END IF;
+IF (EXPECTED_PARENT <> ACTUAL_PARENT) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different PARENT_ID ' || EXPECTED_PARENT || ' - ' || ACTUAL_PARENT);
+END IF;
+IF (EXPECTED_LEVEL <> ACTUAL_LEVEL) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LEVEL_ID ' || EXPECTED_LEVEL || ' - ' || ACTUAL_LEVEL);
+END IF;
+COMMIT;
+
+-- TODO Test40: Update the level of ROOT logger when conf is empty, takes default.
+INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test40: Update the level of ROOT logger when conf is empty, takes default');
+SET EXPECTED_LOGGER = 0;
+SET EXPECTED_PARENT = NULL;
+SET EXPECTED_LEVEL = 4;
+UPDATE LOGDATA.CONFIGURATION
+  SET VALUE = 'INFO'
+  WHERE KEY = 'defaultRootLevel';
+DELETE FROM LOGDATA.CONF_LOGGERS;
+IF (SQLSTATE = '02000' OR SQLSTATE = '00000') THEN
+ UPDATE LOGDATA.CONF_LOGGERS_EFFECTIVE
+   SET LEVEL_ID = EXPECTED_LEVEL
+   WHERE LOGGER_ID = EXPECTED_LOGGER;
+ SELECT LOGGER_ID, PARENT_ID, LEVEL_ID INTO ACTUAL_LOGGER, ACTUAL_PARENT, ACTUAL_LEVEL
+   FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
+   WHERE LOGGER_ID = 0;
+ IF (EXPECTED_LOGGER <> ACTUAL_LOGGER) THEN
+  INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LOGGER_ID ' || EXPECTED_LOGGER || ' - ' || ACTUAL_LOGGER);
+ END IF;
+ IF (EXPECTED_PARENT <> ACTUAL_PARENT) THEN
+  INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different PARENT_ID ' || EXPECTED_PARENT || ' - ' || ACTUAL_PARENT);
+ END IF;
+ IF (EXPECTED_LEVEL <> ACTUAL_LEVEL) THEN
+  INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LEVEL_ID ' || EXPECTED_LEVEL || ' - ' || ACTUAL_LEVEL);
+ END IF;
+ELSE
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Configuration was not deleted completely - ' || SQLSTATE);
+END IF;
+COMMIT;
+
 -- Cleans the environment.
-INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'TestsConfLoggersEffective: Finished succesfully');
+INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'TestsConfLoggersEffective: Cleaning environment');
+UPDATE LOGDATA.CONFIGURATION
+  SET VALUE = 'true'
+  WHERE KEY = 'internalCache';
+UPDATE LOGDATA.CONFIGURATION
+  SET VALUE = 'WARN'
+  WHERE KEY = 'defaultRootLevel';
 UPDATE LOGDATA.CONFIGURATION
   SET VALUE = 'false'
-  WHERE KEY = 'internalCache';
-DELETE FROM LOGDATA.CONF_LOGGERS_EFFECTIVE WHERE LOGGER_ID <> 0;
+  WHERE KEY = 'logInternals';
+DELETE FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
+  WHERE LOGGER_ID <> 0;
+INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'TestsConfLoggersEffective: Finished succesfully');
 COMMIT;
 
 END @

UPDATE LOGDATA.CONF_LOGGERS_EFFECTIVE
  SET PARENT_ID = NULL
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;
IF (RAISED_LG0E1 = FALSE) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Exception not raised');
ELSE
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised LG0E1');
END IF;
SET RAISED_LG0E1 = FALSE;
COMMIT;

-- Test24: Updates a logger with an null level.

SET ACTUAL_LEVEL = 3; -- Default level
INSERT INTO LOGDATA.CONF_LOGGERS_EFFECTIVE (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID) VALUES
  (0, 'test17', ACTUAL_PARENT, ACTUAL_LEVEL);
IF (RAISED_LGBE1 = FALSE) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Exception not raised');
ELSE
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised LG0E1');
END IF;
SET RAISED_LGBE1 = FALSE;
COMMIT;

-- Test18: Updates a normal logger.
