Logging related questions

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Logging related questions

  • Creator
    Topic
  • #48143
    Ivan Ng
    Participant

      How do I create an “info” or a “debug” log entry when doing upoc?  In addition, how do I set the verbosity level when configuring EO alias?  The log entry created by cloverenv.log() does not seem to belong to either info or debug.

      My upoc is doing JMS connection.

      Thank you very much for any response.[/url]

    Viewing 2 reply threads
    • Author
      Replies
      • #57816
        Jonathan Hamilton
        Participant

          You cannot create info or debug messages.

          You can create your own formatted message and echo it in your proc which effectively writes it to the log file.  To get functionality similar to the info level you can pass an argument to turn logging statements on and off.  I wish it was possible to find the current EO info level from within a UPoC so logging could become even more detailed and controllable without an engine bounce.

          Example Code:

          package require utilities

          if {![keylget args ARGS.DEBUG debug]} { set debug “0” }

          log_it2 “Module called from wrong CONTEXT in the engine.” 1

          log_it “Didn’t find any files matching pattern ‘.in.${tmpObfile}’ in ${ftpobdir}.”

          Package Library:

          package provide utilities 1.2

          proc log_it {msg {ovrde 0}} {

             global HciConnName

             upvar #1 module module mh mh debug debug

             if {$debug || $ovrde} {

                 set mid [get_mid $mh]

                 set msg “[tcl :tcl :USER/9:[format %20s $HciConnName]] [$mid] Module ‘$module’: $msgr”

                 echo $msg

             }

          }

          Sample Output:

          [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tps_ob_upoc_ftp_gnrc’: Didn’t find any files matching pattern ‘PT1*’ in /mm03/data.

          [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tps_ob_upoc_ftp_gnrc’: The file name ‘PT111177.04427’ already exists on the remote server!

          [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tpsShowMode’: Protocol driver experienced an error.  Re-queuing message for another attempt at delivery.

          [tcl :tcl :USER/9:adt_smrt_out_QA1A_04427_541] [0.0.320032] Module ‘tpsShowMode’: Halting thread to allow protocol error time to resolve.

        • #57817
          Keith McLeod
          Participant

            On the same note of adding logging information, is there a way to add which user performed the activity?  When you bring up netmonitor, it tells you that it is locked by another user(specifically).  Can this be recorded in the log when threads are bounced or eoaliases stopped and started?

          • #57818
            Charlie Bursell
            Participant

              FWIW there is a library routine already provided that is excellent for debugging.  The procedure name is dputs.

              The naet thing about dputs is that is uses the global _DEBUG_.  If this global is not defined, dputs becomes a NOP thus saving CPU time.  If the global is defined and set to 0, no debug output.  If set to non-zero you get debug output.

              For example, if I have a proc named filterHL7 and I put the following somewhere in my code:

              dputs “THIS IS AN ERROR MESSAGE”

              and if the global _DEBUG_ exists and is set to non-zero, I get:

              debug: (filterHL7) THIS IS AN ERROR

              This proc is located in the library: $HCIROOT/tcl/lib/cloverleaf/GUI.tlib

              I modify mine to give the threadname as well as the procname so the output would be something like:

              debug: (mythread/filterHL7) THIS IS AN ERROR

              Simple to modify the proc, I’ll leave it to you.

              Charlie

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.