I am currently trying to write a power shell script that would capture and write a detailed event log of any error (preventing deployment) from a step in the deployment process. My Current solution is within each script module (logging the error in catch statements) and it seems very inefficient. I must be missing something that would make my life a whole lot easier. Any feedback is much appreciated.
Thanks for getting in touch! Just to ask, is the purpose of the logging used just to prevent the deployment or to capture them all in a singular place?
We have variables that give the status of the steps and also the error code and error message … but maybe they aren’t detailed enough?
Also what version of Octopus are you running?
Have I understood this correctly?
Yes, I pretty much want to do is to create an event log that would log the error that caused a deployment process to stop. I am currently running octopus 126.96.36.199. After looking around would the variables I be looking for be octopus.step.status.error/errordetails?
Sorry for the delay in getting back to you.
Yes you are correct if there is an error would be the correct trigger for logging.
Octopus.Deployment.Error will record the error independent of step, as it’s for the whole deployment. If this has no value there as been no error
Octopus.Deployment.ErrorDetail will have the information if Error is set.