Generalized Nearby Cycles via Logarithmic and Relative D-modules