-- How do you set the logging level for the default context?
declare
x PLOGPARAM.LOG_CTX;
begin
dbms_output.put_line('Current Version = '||plog.getLOG4PLSQVersion); -- 4.0
dbms_output.put_line('Current Level = '||plog.getLevel); -- 70
--plog.setLevel(PLOG.LWARN); -- Why doesn't this line work?
-- If it did work, the next 2 plog lines should not get logged, right?
plog.debug('Logging debug now.');
plog.info('Logging info now.');
plog.warn('Logging warn now.');
plog.error('Logging error now.');
plog.fatal('Logging fatal now.');
-- So I have to make a context (x) and pass it in always in order to change logging level?
x := plog.init;
plog.setLevel(x, PLOG.LWARN); -- next 2 plog lines will not get logged
dbms_output.put_line('Current Level = '||plog.getLevel); -- 70
dbms_output.put_line('Current Level (x) = '||plog.getLevel(x)); -- 40
plog.debug(x,'Logging new debug now.');
plog.info(x,'Logging new info now.');
plog.warn(x,'Logging new warn now.');
plog.error(x,'Logging new error now.');
plog.fatal(x,'Logging new fatal now.');
end;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
-- How do you set the logging level for the default context?
declare
x PLOGPARAM.LOG_CTX;
begin
dbms_output.put_line('Current Version = '||plog.getLOG4PLSQVersion); -- 4.0
dbms_output.put_line('Current Level = '||plog.getLevel); -- 70
--plog.setLevel(PLOG.LWARN); -- Why doesn't this line work?
-- If it did work, the next 2 plog lines should not get logged, right?
plog.debug('Logging debug now.');
plog.info('Logging info now.');
plog.warn('Logging warn now.');
plog.error('Logging error now.');
plog.fatal('Logging fatal now.');
-- So I have to make a context (x) and pass it in always in order to change logging level?
x := plog.init;
plog.setLevel(x, PLOG.LWARN); -- next 2 plog lines will not get logged
dbms_output.put_line('Current Level = '||plog.getLevel); -- 70
dbms_output.put_line('Current Level (x) = '||plog.getLevel(x)); -- 40
plog.debug(x,'Logging new debug now.');
plog.info(x,'Logging new info now.');
plog.warn(x,'Logging new warn now.');
plog.error(x,'Logging new error now.');
plog.fatal(x,'Logging new fatal now.');
end;