RE: [log4plsql] Change logging level for entire application?
Brought to you by:
gmoulard
From: <log...@li...> - 2004-12-06 17:20:34
|
Sandy,=20 =20 You are right, when you change the default level in PLOGPARAM pakage = spec, some code is invalidated.=20 If you want change the default log level, you can use the context.=20 =20 Declare pCTX PLOG.LOG_CTX :=3D PLOG.init (pLEVEL =3D> PLOG.LDEBUG); begin PLOG.debug (pCTX, 'Hello LOG'); end; / =20 =20 If we don't use a constant for the default level, we can't use it in a static declaration:=20 =20 FUNCTION init ( pSECTION IN TLOG.LSECTION%type default NULL , -- root of the tree section pLEVEL IN TLOG.LLEVEL%type default PLOGPARAM.DEFAULT_LEVEL , -- log level (Use only for debug) pLOG4J IN BOOLEAN default PLOGPARAM.DEFAULT_USE_LOG4J, -- if true the log is send to log4j pLOGTABLE IN BOOLEAN default PLOGPARAM.DEFAULT_LOG_TABLE, -- if true the log is insert into tlog = pOUT_TRANS IN BOOLEAN default PLOGPARAM.DEFAULT_LOG_OUT_TRANS, -- if true the log is in transactional = log pALERT IN BOOLEAN default PLOGPARAM.DEFAULT_LOG_ALERT, -- if true the log is write in = alert.log pTRACE IN BOOLEAN default PLOGPARAM.DEFAULT_LOG_TRACE, -- if true the log is write in trace = file pDBMS_OUTPUT IN BOOLEAN default PLOGPARAM.DEFAULT_DBMS_OUTPUT, -- if true the log is send in standard output (DBMS_OUTPUT.PUT_LINE) pDBMS_PIPE_NAME IN VARCHAR2 default PLOGPARAM.DEFAULT_DBMS_PIPE_NAME, -- pDBMS_OUTPUT_WRAP IN PLS_INTEGER default PLOGPARAM.DEFAULT_DBMS_OUTPUT_LINE_WRAP ) RETURN LOG_CTX; =20 =20 There is a lot of performance problem.=20 =20 let me know if they is big problems for you. =20 Guillaume =20 _____ =20 De : log...@li... [mailto:log...@li...]=20 Envoy=E9 : dimanche 28 novembre 2004 22:55 =C0 : log...@li... Objet : [log4plsql] Change logging level for entire application? =20 Hi,=20 This is an excellent and extremely useful program for plsql development. Thank you for taking the time to write and maintain this program and = thanks for making it open source.=20 I have one question though: If I want to set the logging level for the entire application/database to e.g. info because I have to trace a bug = on a production system I=92d like to be able to do so without invalidating = the plog and plogparam packages and hence all packages that make use of = log4plsql.=20 The only way to set the logging level for the entire database is to = change the value of the DEFAULT_LEVEL constant in the plogparam package specification. (At least that is what I believe but as a beginner I = might be wrong here ...).=20 If this really is the case I think it would be a good idea to define the constants in the package body as the recompilation of a body does not = cause the other packages to be invalidated. I=92d suggest to change the code similar to the following:=20 Pslogparam.sql: replace constant DEFAULT_LEVEL with FUNCTION specification getApp_logginglevel (reason: prevent invalidation in case of = recompilation) =20 Pblogparam.sql:=20 FUNCTION getApp_loggingLevel RETURN tlog.llevel%TYPE IS lv_app_logging_level tlog.llevel%TYPE; BEGIN lv_app_logging_level :=3D 70; -- all RETURN lv_app_logging_level; END getApp_loggingLevel;=20 What do you think of this? Or is there some functionality already where = I can achieve the same results without recompiling the package spec? Cheers,=20 Sandy=20 |