The paper presents a universal and extremely simple method for studying railway traffic safety, which enables the measurement of safety-related aspects to be conducted with reference to both infrastructure and rolling stock at the same time. The method proposed in the article is an attempt to face up to the challenge of the aforementioned constraint, enabling measurements of characteristics of the railway line infrastructure and of the rolling stock by means of common accelerometers installed in mobile phones. Result obtained illustrates accelerations recorded in three axes. Studying average characteristics for the same train set, one can reveal anomalies related to the track or the rolling stock condition