1
0
-1

I am trying to clear out the userver log files that are created by our system, by identifying where the errors are coming from and then fixing them in the source code (or programming around them, so testing for file existence before trying to load it, that kind of thing). 

What makes this difficult is not knowing which service has caused the error. In the past, I have looked at the help page for (e.g. 0160) and they (mostly) have code I can copy and paste for the error message and simply add (%%$componentname%%%) to the end of. 

I've looked in the help page for 0160, and it doesn't have this useful information. 

I have checked out the libmsg.usys.xml in uniface\misc, and it doesn't appear to include this message. 

Am I missing an import file which includes the 0000-1000 (or other) messages? Or some way to get the definition so I can create my own message to get the needed diagnostic info? 


Also, if you are reading this, and you think it makes sense, please find my wish that userver can be configured to add the component name to the end/beginning of all these messages as a whole, to make diagnosis 1000% easier

, and give it a vote.... 


Iain 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I do like this, and will probably use it, primarily as an additional UAR that only uservers can see, so as not to confuse users. 

      However, it does not address the original point, which is that I don't know what I should put in the message part of my replacement 0160 in order to get the original message back, with the additional stuff added. 

      I can open the uar, and copy the .msg file out and look at it in a text editor, but that doesn't tell me what I should type in the message editor in order to get it to replace something with the global field name. 

      Thanks for that above though, I wouldn't have thought of that on my own. 


      Iain

      1. Daniel Iseli

        The original message text looks like this:

        0160 - Global variable %%$sub%%% not available.
      2. Norbert Lauterbach

        Hi Iain,

        sorry I forgot.

        The message 0160 should look like 

        0160 - Global variable %%$sub not available. %%CF_LOG("0160")


        If you open a message with HEX-Editor you sometimes find HEX 01 D5 00 this should be "%%$sub".


        Hope this helps.


        Regards

        Norbert

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi Iain,

      here is something that makes it 1000% easier for you.

      Messages can be found in common\usys\usys.uar

      When Uniface raises these messages there is nothing to be found in the logfile.

      You can change this by adding a %%CF_LOG("<MessageNumber>") to the end of the message.


      Global Function CF_LOG
      returns string
      params
      string P_MSG : in
      endparams
      variables
      string V_TEXT
      string V_PROCERROR
      string V_PROCERRORCONTEXT
      string V_DATAERRORCONTEXT
      string V_FORM
      string V_ENT
      string V_FELD
      string V_WERT
      endvariables
      V_PROCERROR = $procerror
      V_PROCERRORCONTEXT = $procerrorcontext
      V_DATAERRORCONTEXT = $dataerrorcontext
      V_FORM = "%%$formname / %%$componentname"
      if ($procerror < 0)
      V_FORM = "-FORM-"
      endif
      V_ENT = $entname
      if ($procerror < 0)
      V_ENT = "-ENT-"
      endif
      V_FELD = $fieldname
      if ($procerror < 0)
      V_FELD = "-FELD-"
      V_WERT = "-WERT-"
      else
      V_WERT = @$fieldname
      endif
      
      V_TEXT = "%%$datim , %%P_MSG , %%$$ABTEILUNG , %%$$COMPUTERNAME, %%$processinfo("pid") , %%$$USER , %%V_FORM , %%V_ENT , %%V_FELD , %%V_WERT"
      V_TEXT = "%%V_TEXT%%% , Error: %%V_PROCERROR occurred at %%V_PROCERRORCONTEXT , Context: %%V_DATAERRORCONTEXT"
      V_TEXT = "%%V_TEXT%%^%%CF_CALLSTACK()"
      
      filedump/append "%%V_TEXT%%^", "%%$$CLI_APPL_DIR%%%..\EB\LOG\_Messages.log"
      putmess V_TEXT
      return ""
      Global Function CF_CALLSTACK
      returns string
      variables
      string V_PROCSTACK
      string V_SINGLEPOINT
      string V_DATA
      string V_OUTPUT
      NUMERIC V_COUNTER
      NUMERIC V_LINE
      endvariables
      V_PROCSTACK = $proccontext("STACK")
      V_COUNTER = 3
      getitem V_SINGLEPOINT, V_PROCSTACK, V_COUNTER
      V_OUTPUT = ""
      while($STATUS > 0)
      if($item("MODNAM",V_SINGLEPOINT) != "APPL")
      V_LINE = $item("LNR",V_SINGLEPOINT)
      if($item("TYPE", V_SINGLEPOINT) = "MOD")
      V_DATA = "%%$item("CPTNAM",V_SINGLEPOINT)%%% %%$item("MODNAM",V_SINGLEPOINT)%%% %%V_LINE%%% %%$item("LIN", V_SINGLEPOINT)%%%"
      else
      V_DATA = "%%$item("CPTNAM",V_SINGLEPOINT)%%% %%$item("MODNAM",V_SINGLEPOINT)%%% %%V_LINE%%% [%%$item("ENTITY",V_SINGLEPOINT)%%%.%%$item("FIELD",V_SINGLEPOINT)%%%] %%$item("LIN", V_SINGLEPOINT)%%%"
      endif
      V_OUTPUT = "%%V_OUTPUT%%V_DATA%%^"
      endif
      V_COUNTER += 1
      getitem V_SINGLEPOINT, V_PROCSTACK, V_COUNTER
      endwhile
      return V_OUTPUT
      
      


      This will add something like

      16.02.2021 12:46:06 , 0160 , ARA , L1790147, 41492 , FRAM802L , TEST_U10_1 / TEST_U10_1 , ENT1 , BUTTON , Start , Error: 0 occurred at  , Context: 
      TEST_U10_1   trigger DETAIL   4   [ENT1.BUTTON]   putmess $$GLOBAL_VAR

      to the logfile.


      Kind Regards

      Norbert

        CommentAdd your comment...