webMethods

 View Only
  • 1.  pub.flow:debugLog -- including variable values in messages

    Posted 28 days ago

    I'd like to do something like create a message "header status was %/header/status%" and have the %...% string be interpolated with the value of the variable in the pipeline. Is this possible?

    Thanks in advance.



    ------------------------------
    Adam Connor
    ------------------------------


  • 2.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 28 days ago

    @Adam Connor : Yes its possible. Try it. provide more information if you are looking for something else.



    ------------------------------
    Vivek Kanojia
    ------------------------------



  • 3.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 27 days ago

    Hi Adam,

    If your intention is to just log the value of header/status field using debugLog service field then hardcoding the input message as %header/status% with Perform Pipeline Varible option being checked in the checkbox should work fine provided header/status field is available in the pipeline at that step

    But say status is 200 and you want the message to be written as %200% i.e, including the % in the log message then I am not sure how this can be achieved.



    ------------------------------
    Kailash Kumar Mishra
    ------------------------------



  • 4.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 27 days ago

    Thanks, I got it. My problem was two-fold: 1) I was missing the fact that I had to check a checkbox (weird, but oh well), and 2) my flow had dropped the variable at a point about the else branch.

    Not in love with the soup of global variables, but again, oh well.



    ------------------------------
    Adam Connor
    ------------------------------



  • 5.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 27 days ago

    Hi Adam,

    Glad that the shared information helped and you were able to work your way out.



    ------------------------------
    Kailash Kumar Mishra
    ------------------------------



  • 6.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 14 days ago

    For a modern day developer, indeed the "soup of global variables" can become frustrating at times, but you will soon learn that it is often convenient. Just try to be disciplined and drop variables from the pipeline as soon as you no longer need them to keep your pipeline small and manageable. This has benefits for both design-time and run-time.

    Good luck,

    Percio

    https://nibl.tech



    ------------------------------
    Percio Castro
    ------------------------------



  • 7.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 14 days ago

    By the way, this is neither here nor there since it's not related to your question, but a couple of thoughts on logging:

    1. Use pub.flow:debugLog for debugging purposes only. For logging that is intended to take place in Production, you should consider creating a logging package that is a bit more robust and that writes log events to a separate log file using a logging framework like Log4Jv2 or similar.
    2. Instead of emiting plain text log events, consider emitting structured log events (e.g. JSON). This unlocks all sorts of potential if you later choose to ship your logs to a platform like Splunk, Elastic, Loki, etc.
    3. When emitting structured log events, consider breaking up the static content of your events from the variable content. Again, if you later choose to ship your logs to one of the platforms above, which I highly recommend, separating the static content from the variable will enable you to write simpler and more powerful queries and it will also enable you to create simpler and richer dashboards.

    I grabbed a sample log event from my application and changed the message and attributes to reflect your use case for illustrative purposes:

    {"timestamp":"2025-03-11 14:34:33.466","level":"Info","type":"Step","environment":"dev","status":"Running","attributes":{"httpStatus": 200},"message":"HTTP header status","source":{"instance":"19bfeb75-7cf2-49e9-b31d-97114976208e","class":"my.folder.structure","method":"myService","threadId":"462","threadName":"Server Thread Pool"}}

    I could elaborate more if needed.

    Percio

    https://nibl.tech



    ------------------------------
    Percio Castro
    ------------------------------



  • 8.  RE: pub.flow:debugLog -- including variable values in messages

    Posted 27 days ago

    What issue are you facing?



    ------------------------------
    - Chirag
    ------------------------------