how to limit output from .edit command to step log?
![]() Hi All, We used the .edit command to find and replace files, and each about 400,000 lines. Dot command .edit writes all lines that it finds and replace to step log which is too many. All we want is success or failure output to step log; is there a way to do so? Please help! Thanks Michael |
Accepted answer
![]()
Hello Michael,
There are two trigger variables that can be used.
To see a full list of trigger variables including the two above with additional information see the link below.
You can set these in the environment, or even better, when you go to start the project, you can have an environment variable for the project as a drop down. This way you can select to either have the option on or off.
Let me know if this helps!
Thanks!
Michael Dang selected this answer as the correct answer
|
4 other answers
![]()
Hi Ryan,
Thanks for the answer. But trigger variable "
Any ideas? |
![]()
Hey Michael,
Well, there is _CONTEXT_LOG_RANGE. When a project fails, it fails with a "FilterMatch". What this value does is limit the actual log output to just what is surrounding match on the filter.
This way if my project fails. It will print out lines before and after my failure. For example, if I set this value to 10. It will print out the 10 leading and 10 following log lines surrounding the Filter Match or AKA: Failure.
This can help give insight into why it's failed if that is what you are looking for. You can also set this per project or per step.
LASTLY,
Ok, well let's say I want other information. Say something fails but does not actually get caught by a filter. Well, you can go and create your own filters in which to catch certain information that will allow the LOG_RANGE to work.
Well, this is the last part. Say, you made the variable a drop down with 1, 5, 10... values. Normally you have it set to 1. So nothing really get's printed. But you can restart the build, and on the launch page, find the value and use the drop down to select 10. Then it re-runs the step, fails and prints out 10 lines. You find your answer you change it back to the default of 1. This works the same with the SUPPRESS of the log data. Just a handy way to turn on and off and not have to actually edit the project each time... What a pain!
Hope this helps you?
Please let us know by liking our answers if they are correct.
Thanks!
|
![]()
Hi Ryan,
In this case, we have to create a log filter looking a range of error strings, then set trigger varialbe _CONTEXT_LOG_RANGE, and NOT set trigger varialbe _SUPPRESS_LOG_OUTPUT, correct? If it is true, a lot of work.
Are these only options for us to eliminate massive outputs from .edit command? If so, we are going to write our own edit command script, and suggesting for enhancing .edit command.
Thanks
Michael
|
![]()
Hey,
Yeah, so you just need to set _context_log_range and _suppress_log_output. Then set context range to however many lines before and after the error you want.
You don't need to create filters, they should already all be there. This is just something that you can do for very special
circumstances. An option for other readers who may read the post and wonder about it.
As far as .edit goes it's really only meant to be used like string substitution. To find and replace values and there is no
way to limit it.
Sorry I don't have any other creative ways of getting exactly what you are looking for but hopefully this helps.
Thanks!
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.