Xlate Log Echos

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Xlate Log Echos

  • Creator
    Topic
  • #51959
    Tim Jipson
    Participant

      Does any know which engine output parameter controls xlate echos being added to the process log?

    Viewing 6 reply threads
    • Author
      Replies
      • #72501
        Keith McLeod
        Participant

          From my experience, it is pretty much any echo statement or puts statement will write to the process log.

        • #72502
          Russ Ross
          Participant

            We have an inhouse xltecho proc that I find handy to echo things out  to the process log while debugging or during initial development.

            Since we are on Cloverleaf 5.6, I can simply comment out the CALL to xltecho once I’m finished debugging or developing and leave it until I might needed it again at a later date.

            Here is the source code and an attached screenshot of an example showing how I used it for an echo in one of my xlates (NOTE: be sure to use the CALL and not COPY)

            Code:

            ################################################################################
            # Name: xltecho
            # Purpose: xltecho will echo each element name and it’s value from the Source
            #           list of an Xlate.
            #           This can be helpful in debugging complex or lengthy Xlates.
            # UPoC type: xltp
            # Args: @xltecho_debug – controls the issuance of debug information
            # Author:   James R. Kosloskey
            # Date-written: 12/28/1998
            #
            #*******************************************************************************
            #*                             C O D E   A U D I T                             *
            #*_____________________________________________________________________________*
            #*Date       I-Catcher  Description                                            *
            #*———- ———- ——————————————————-*
            #*12/17/1998            Conception
            #*_____________________________________________________________________________*
            #*03/10/2004 jrk031004  Mark module with version number.
            #*                      Use string toupper instead of translit.
            #*_____________________________________________________________________________*
            #*******************************************************************************
            #
            # Notes: All data is presented through special variables.  The initial
            # upvar in this proc provides access to the required variables.
            #
            # This proc style only works when called from a code fragment
            # within an XLT.
            #
            ################################################################################
            #
            # Copyright: Copyright(c) 1998, Oakwood Healthcare System. All rights reserved.

            proc xltecho {} {
               upvar xlateId       xlateId
             xlateInList   xlateInList
             xlateInTypes  xlateInTypes
             xlateInVals   xlateInVals
             xlateOutList  xlateOutList
             xlateOutTypes xlateOutTypes
             xlateOutVals  xlateOutVals

            # Global variables
               global HciConnName

            # Local variables – initialization
            # jrk031004 Start
               set module “XLTECHO v1.1”
            # jrk031004 End
               set num_elems “”
               set list_cnt 0
            #
            #******************************************************************************************************
            # Setup the field IDs necessary for this procedure
            #******************************************************************************************************
            #
               set debug_id {@xltecho_debug}             ;# xltecho debug switch
            #
            #******************************************************************************************************
            # Setup the Indexes into the Inbound list for the above arguments
            #******************************************************************************************************
            #
               set debug_ndx {}                          ;# xltecho debug switch index
            #
            #******************************************************************************************************
            # Setup the Storage Area for the above arguments
            #******************************************************************************************************
            #
               set debug_sw {N}                          ;# debug switch
            #
            #******************************************************************************************************
            # Get the DEBUG argument
            #   Find the debug argument position if it exists in the inbound list
            #   If it does not exist, notify the invoker
            #   If it does exist, find the value of the switch
            #       Convert a lower case y to upper case
            #******************************************************************************************************
            #
               set debug_ndx [lsearch $xlateInList $debug_id]
               if {$debug_ndx == -1} {                     ;# Did we find the argument?
                   echo “$HciConnName $module: Can’t find $debug_id – required.”
                   set fatal_err 1               ;# Set fatal error switch
                  } else {                         ;# Found, convert lower case y to upper
            # jrk031004 Start
                   set debug_sw [string toupper [lindex $xlateInVals $debug_ndx]]     ;#Change lower to upper
            # jrk031004 End
               }  
            #
            #******************************************************************************************************
            # If debug is set display the xlateInList
            #******************************************************************************************************
            #
               if {$debug_sw == “Y”} {
                   echo “$HciConnName $module: *** START *********************************************************************************************”
                   echo “$HciConnName $module: xlateInList >$xlateInList$xlateInVals$num_elems$list_cnt$curr_elem_name$curr_elem_value<."
                       incr list_cnt 1   ;# Increment the pointer
                   }  ;#End foreach
                   echo "$HciConnName $module: ———————— End ———————-"
               }  ;# Endif debug

            }  ;# End xltecho

            Russ Ross
            RussRoss318@gmail.com

          • #72503

            It’s very simple to output statements to the process logs from an Xlate. Simply add a puts or echo statement to the tcl field.

            Here’s an example.

            -- Max Drown (Infor)

          • #72504
            Tim Jipson
            Participant

              Russ, Thats a neat script and I’ll tuck it away for later use but it’s not  what I need right now.

              Keith, I thought echo statements always hit the log until last week.

              When configuring a thread if I specify sane_eo or enable_all I get echos in the log but if I leave the box blank then I don’t get any echos. So either cloverleafs ‘default’ EO is buggy or one of the EO settings is controlling the echos.

            • #72505

              Tim, you shouldn’t need to enable EO to see your echo statements in the log. Do you see the echos when you run the xlate through the testing tool?

              -- Max Drown (Infor)

            • #72506
              Jim Kosloskey
              Participant

                Tim,

                We are on Cloverleaf 5.6 and all of the echos issued by any of the xltp type Tcl procs we use end up in the process log just fine no matter what the EO config including ‘off’.

                So maybe there is something else going on in your case.

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #72507
                Tim Jipson
                Participant

                  I swear this echo problem was happening last week but I can’t duplicate the problem even with disable_all I’m getting echos properly now.

                  Maybe it was just pre-weekend syndrome? Thanks for your help.

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