 
 !DB2 -TF CLEANTRIGGERS.SQL +O @
 
+CREATE OR REPLACE TRIGGER T1_CONF_CACHE
+  AFTER INSERT OR UPDATE ON LOGDATA.CONFIGURATION
+  REFERENCING NEW AS N
+  FOR EACH ROW
+ T_CONF_CACHE: BEGIN
+  DECLARE TMP ANCHOR LOGDATA.CONFIGURATION.VALUE;
+  CASE N.KEY
+   WHEN 'internalCache' THEN
+    IF (N.VALUE = 'true') THEN
+     CALL LOGGER.ACTIVATE_CACHE();
+    ELSE
+     CALL LOGGER.DEACTIVATE_CACHE();
+    END IF;
+   ELSE
+    -- NOTHING.
+  END CASE;
+ END T_CONF_CACHE@
 CREATE OR REPLACE TRIGGER T3_EFFECTIVE_INSERT
   BEFORE INSERT ON LOGDATA.CONF_LOGGERS_EFFECTIVE
   REFERENCING NEW AS N

UPDATE LOGDATA.CONFIGURATION
  SET VALUE = 'false'
  WHERE KEY = 'logInternals';
CALL LOGGER.REFRESH_CONF ();
COMMIT;

-- Test1: empty string.

DELETE FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
  WHERE LOGGER_ID <> 0;
INSERT INTO LOGDATA.LOGS (DATE, LEVEL_ID, MESSAGE) VALUES (GENERATE_UNIQUE(), 3, 'TestsGetLogger: Finished succesfully');
UPDATE LOGDATA.CONFIGURATION
  SET VALUE = 'true'
  WHERE KEY = 'internalCache';
UPDATE LOGDATA.CONFIGURATION
  SET VALUE = 'false'
  WHERE KEY = 'logInternals';
