A general method for constructing logarithmic modules in vertex operator algebra theory is presented. By utilizing this approach, we give explicit vertex operator construction of certain indecomposable and logarithmic modules for the triplet vertex algebra W(p) and for other subalgebras of lattice vertex algebras and their N = 1 super extensions. We analyze in detail indecomposable modules obtained in this way, giving further evidence for the conjectural equivalence between the category of W(p)-modules and the category of modules for the restricted quantum group (U) over bar (q)(sl(2)), q = e(pi i/p). We also construct logarithmic representations for a certain affine vertex operator algebra at admissible level realized in Adamovic (J. Pure Appl. Algebra 196: 119-134, 2005). In this way we prove the existence of the logarithmic representations predicted in Gaberdiel (Int. J. Modern Phys. A 18, 4593-4638, 2003). Our approach enlightens related logarithmic intertwining operators among indecomposable modules, which we also construct in the paper.