By the way, this is neither here nor there since it's not related to your question, but a couple of thoughts on logging:
- 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.
- 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.
- 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
------------------------------
Original Message:
Sent: Wed February 26, 2025 12:00 PM
From: Adam Connor
Subject: pub.flow:debugLog -- including variable values in messages
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
Original Message:
Sent: Wed February 26, 2025 08:33 AM
From: Kailash Kumar Mishra
Subject: pub.flow:debugLog -- including variable values in messages
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
Original Message:
Sent: Tue February 25, 2025 05:22 PM
From: Adam Connor
Subject: pub.flow:debugLog -- including variable values in messages
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
------------------------------