Occurrence of a failure in a computer system is appropriately detected, and information required for removing the failure is automatically collected. A trace information collecting system of the present invention which collects trace information indicating the course of processing of a program comprises a history recording section for recording a history of run and stop of a target program for which the trace information is to be produced, a similarity calculating section for calculating a degree of similarity between a first operation pattern in which the target program ran and stopped at the last time and a second operation pattern in which the target program ran and stopped at the time before last when the target program, which once stopped, starts to run, a failure occurrence determining section for determining that a failure occurred when the target program ran at the last time on condition that the similarity calculated by the similarity calculating section is lower than a reference similarity, and a trace information collecting section for collecting the trace information from the target program in response to the determination that the failure occurred, wherein the trace information is not collected if it is determined that the failure did not occur.