   NO EXTERNAL ACTION
   MODIFIES SQL DATA
  P_LOG_SQL: BEGIN
-  INSERT INTO LOGS (DATE, LEVEL_ID, LOGGER_ID, ENVIRONMENT, MESSAGE) VALUES
-    (CURRENT TIMESTAMP, LEVEL_ID, LOGGER_ID, CURRENT USER, MESSAGE); 
+  INSERT INTO LOGS (LEVEL_ID, LOGGER_ID, ENVIRONMENT, MESSAGE) VALUES
+    (LEVEL_ID, LOGGER_ID, CURRENT USER, MESSAGE); 
  END P_LOG_SQL@
 ALTER MODULE LOGGER PUBLISH 
   PROCEDURE LOG_DB2DIAG (

  END IF;
END P_LOG@


  DECLARE APPENDERS CURSOR FOR
    SELECT APPENDER_ID, CONFIGURATION
    FROM CONF_APPENDERS;
  DECLARE CONTINUE HANDLER FOR SQLSTATE '55019'
    INSERT INTO LOGS (LEVEL_ID, LOGGER_ID, ENVIRONMENT, MESSAGE) VALUES 
    (1, 0, CURRENT USER, 'Appender not available');
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET AT_END = TRUE;

  -- Retrieves the current level in the configuration for the given logger.
  SELECT C.LEVEL_ID INTO CURRENT_LEVEL_ID 
    FROM CONF_LOGGERS_EFFECTIVE C
    WHERE C.LOGGER_ID = LOGGER_ID
    FETCH FIRST 1 ROW ONLY;

  -- Checks if the current level is at least equal to the provided level.
  -- TODO Verificar esto, ya que aqu se puede usar la tabla references, si root
  -- no est activo.
