We consider volume-preserving flows on , where S is a compact connected surface of genus g a parts per thousand yen 2 and has the form where is a locally Hamiltonian flow of hyperbolic periodic type on S and f is a smooth real valued function on S. We investigate ergodic properties of these infinite measure-preserving flows and prove that if f belongs to a space of finite codimension in , then the following dynamical dichotomy holds: if there is a fixed point of on which f does not vanish, then is ergodic, otherwise, if f vanishes on all fixed points, it is reducible, i.e. isomorphic to the trivial extension . The proof of this result exploits the reduction of to a skew product automorphism over an interval exchange transformation of periodic type. If there is a fixed point of on which f does not vanish, the reduction yields cocycles with symmetric logarithmic singularities, for which we prove ergodicity.