RE: [log4plsql] Problem using Log4j feature.
Brought to you by:
gmoulard
From: <log...@li...> - 2005-05-11 12:27:15
|
The problem is due to a bug in the listener thread. messages in the pipe are not written and read in the same way, hance = reading in the pipe throws a SQLException. Code from package plog ------------------------ DBMS_PIPE.pack_message(pID); -- SEQUENTIAL ID DBMS_PIPE.pack_message(pLDATE); -- TIMESTAMP OF = LOG STATEMENT DBMS_PIPE.pack_message(MOD(pLHSECS,100)); -- HUNDREDTHS OF = SECONDS FOR TIMESTAMP DBMS_PIPE.pack_message(pLLEVEL); -- LOG LEVEL DBMS_PIPE.pack_message(pLSECTION); -- LOG SECTION - = ANALOGUE TO LOG4J Logger NAME DBMS_PIPE.pack_message(LLTEXTE); -- LOG MESSAGE DBMS_PIPE.pack_message(pLUSER); -- CALLING USER DBMS_PIPE.pack_message('SAVE_IN_LOG'); -- MESSAGE TYPE? DBMS_PIPE.pack_message(PMDC.getKeyString); -- MAPPED DOMAIN = CONTEXT KEYS FOR LOG4J DBMS_PIPE.pack_message(PMDC.getValueString); -- MAPPED DOMAIN = CONTEXT VALUES FOR LOG4J DBMS_PIPE.pack_message(PMDC.getSeparator); -- MAPPED DOMAIN = CONTEXT SEPARATOR FOR LOG4J=20 Code from ReaderLogDataBase.sqlj -------------------------------- long piped_ID ; =20 String piped_LDATE ;=20 long piped_LHSECS ;=20 int piped_LLEVEL ; =20 String piped_LSECTION ;=20 String piped_LTEXTE ; =20 String piped_LUSER ; =20 String piped_COMMAND =3D "WAIT"; =20 ... #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_ID)} ; =20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_LDATE)};=20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_LLEVEL)};=20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_LSECTION)};=20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_LTEXTE)};=20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_LUSER)};=20 #sql [ctx] { CALL DBMS_PIPE.unpack_message(:out = piped_COMMAND)}; piped_LDATE must be of type Date and pLHSECS is not retrieved. -----Message d'origine----- De : log...@li... [mailto:log...@li...] Envoy=E9 : mardi 10 mai 2005 19:41 =C0 : log...@li... Objet : RE: [log4plsql] Problem using Log4j feature. In addition to my previous message I have written this procedure and it = works well. So it shows that the message is actually written to the = pipe. declare=20 s integer ; id number; ldate date; lhsecs number; lhlevel number; lsection varchar2(2000); ltext varchar2(2000); luser varchar2(30); begin plog.error('erreur toto'); s :=3D dbms_pipe.receive_message('LOG_PIPE',1); dbms_output.put_line(to_char(s)); dbms_pipe.unpack_message(id); dbms_pipe.unpack_message(ldate); dbms_pipe.unpack_message(lhsecs); dbms_pipe.unpack_message(lhlevel); dbms_pipe.unpack_message(lsection); dbms_pipe.unpack_message(ltext); dbms_pipe.unpack_message(luser); dbms_output.put_line(id||' '||ldate||' '||lhsecs||' '||lhlevel||' = '||lsection||' '||ltext||' '||luser); end; -----Message d'origine----- De : log...@li... [mailto:log...@li...] Envoy=E9 : mardi 10 mai 2005 18:50 =C0 : log...@li... Objet : [log4plsql] Problem using Log4j feature. Hi all, I try to use the log4j feature with log4plsql. Unfortunetly, the listener process seems not to receive messages from = the DBMS_PIPE. Here is a fragment of the listener's ouput :=20 -------------------------------------------------------------------------= -- 2005-05-10 17:29:03,382 INFO [main] backgroundProcess.Run (Run.java:62) = - start log4plsql.properties: ./properties/log4plsql.xml = 2005-05-10 17:29:03,388 DEBUG [main] = backgroundProcess.Run (Run.java:63) - log4j .properties : = /ulis/users/ulisu9/Log4plsql/properties/log4j.xml = 2005-05-10 17:29:03,430 DEBUG [main] backgroundProcess.ReaderThread = (ReaderThrea d.java:40) - ReaderLogDataBase : Connect = 2005-05-10 17:29:03,461 DEBUG [main] = backgroundProcess.ReaderLogDataBase (Reader LogDataBase.sqlj:78) - = Start logSource:source1 dbURI:jdbc:oracle:thin:@127.0.0.1 :1542:PRODU9 = dbUser:ulog dbPass:ulog pipeName:LOG_PIPE = 2005-05-10 17:29:04,207 INFO [main] backgroundProcess.ReaderLogDataBase = (Reader LogDataBase.sqlj:85) - Startup logSource:source1 = dbURI:jdbc:oracle:thin:@127.0.0 .1:1542:PRODU9 dbUser:ulog dbPass:ulog = pipeName:LOG_PIPE 2005-05-10 17:29:04,355 DEBUG = [main] backgroundProcess.DynamicLevel (DynamicLeve l.java:34) - Level = Creation name:OFF level:99999 syslogEquiv:10 =20 ..... 2005-05-10 17:29:48,999 DEBUG [Thread-1] = backgroundProcess.ReaderLogDataBase (Re aderLogDataBase.sqlj:147) - = Start Log4j Backgroung fetching 2005-05-10 = 17:29:49,002 DEBUG [Thread-1] backgroundProcess.ReaderLogDataBase (Re = aderLogDataBase.sqlj:169) - DBMS_PIPE.receive_message:1 = 2005-05-10 17:29:49,003 DEBUG [Thread-1] = backgroundProcess.ReaderLogDataBase (Re aderLogDataBase.sqlj:210) - Nbr = line read in logSource:source1 : 0 =20 --------------------------------------------------- You can see that the DBMS pipe name is the default and that's the same = in the PLOGPARAM package. By inserting some debug code to the PLOG.LOG procedure I noticed that it = actually writes to the pipe (the following code is executed and ret is = 0). ret :=3D DBMS_PIPE.send_message(pCTX.DBMS_PIPE_NAME); =20 IF RET <> 0 then raise_application_error(ERR_CODE_DBMS_PIPE, = MES_CODE_DBMS_PIPE || RET); END IF; =20 But the "DBMS_PIPE.receive_message:1" message seems to mean that the = listener process finds no message in the pipe. Am I right ? Do you know where it comes from ? ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dick _______________________________________________ Log4plsql-all-info mailing list Log...@li... https://lists.sourceforge.net/lists/listinfo/log4plsql-all-info log4plsq : http://log4plsql.sourceforge.net ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_ids93&alloc_id=16281&op=3Dick _______________________________________________ Log4plsql-all-info mailing list Log...@li... https://lists.sourceforge.net/lists/listinfo/log4plsql-all-info log4plsq : http://log4plsql.sourceforge.net |