Hi All,
I'm having a bit of trouble logging a specific HTTP header for each sampler & subResult to the JMeter results log. This value of this field can change even within the resources in a page. I am aware of the sample_variables property (and use it regularly) however from what I could work out from the source, it uses the same value for a sampleResult and all it's subResults - there is only one sampleEvent. I can easily extract the value required and can print it out from a JS223 Post-processor/Listener etc, but I can't figure out where I can store the value so it is picked up by the logging code. I had thought of using another field such as the AssertionMessage but that will get overwritten if there is an actual assertion on a particular step. For reference I am using the "-l, --logfile <argument>" command line argument to configure the results logging. Cheers, Owen |
Am 22.02.21 um 05:47 schrieb Owen Pahl: > Hi All, > > I'm having a bit of trouble logging a specific HTTP header for each sampler > & subResult to the JMeter results log. This value of this field can change > even within the resources in a page. > > I am aware of the sample_variables property (and use it regularly) however > from what I could work out from the source, it uses the same value for a > sampleResult and all it's subResults - there is only one sampleEvent. > > I can easily extract the value required and can print it out from a JS223 > Post-processor/Listener etc, but I can't figure out where I can store the > value so it is picked up by the logging code. > I had thought of using another field such as the AssertionMessage but that > will get overwritten if there is an actual assertion on a particular step. > > For reference I am using the "-l, --logfile <argument>" command line > argument to configure the results logging. Do you want to log those headers or should they be part of the results file? If you want to log them, then you can use the log object, that every JSR223 element gets injected. Those entries will be sent to the file jmeter.log. Maybe it helps, if you explain, why you want to "log" the header. That way, we can get a better understanding, how to help best. Felix > > > Cheers, > Owen > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Hi Felix,
The intent is to include the data with the regular results. If I just needed to log to a file (jmeter.log or otherwise), we wouldn't be having this discussion :) In this particular case the header contains information about where the request was handled, there is a transparent load balancer in front of the service and sub-results may be handled by a different host/data center depending on the URL. This data will be used to confirm the load balancing is working as expected and to aid any potentially required debugging. There is also a theoretical question here about logging arbitrary data that may change per sample/sub-sample to the Jmeter results file. I did think about maybe writing this header data to a separate file, but then I would still need a way to create a log some sort of identifier in the results log to correlate the two logs ... Cheers, Owen On Wed, 24 Feb 2021 at 05:04, Felix Schumacher < [hidden email]> wrote: > > Am 22.02.21 um 05:47 schrieb Owen Pahl: > > Hi All, > > > > I'm having a bit of trouble logging a specific HTTP header for each > sampler > > & subResult to the JMeter results log. This value of this field can > change > > even within the resources in a page. > > > > I am aware of the sample_variables property (and use it regularly) > however > > from what I could work out from the source, it uses the same value for a > > sampleResult and all it's subResults - there is only one sampleEvent. > > > > I can easily extract the value required and can print it out from a JS223 > > Post-processor/Listener etc, but I can't figure out where I can store the > > value so it is picked up by the logging code. > > I had thought of using another field such as the AssertionMessage but > that > > will get overwritten if there is an actual assertion on a particular > step. > > > > For reference I am using the "-l, --logfile <argument>" command line > > argument to configure the results logging. > > Do you want to log those headers or should they be part of the results > file? > > If you want to log them, then you can use the log object, that every > JSR223 element gets injected. Those entries will be sent to the file > jmeter.log. > > Maybe it helps, if you explain, why you want to "log" the header. That > way, we can get a better understanding, how to help best. > > Felix > > > > > > > Cheers, > > Owen > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > > |
Free forum by Nabble | Edit this page |