  By introducing an invariant of loops on a compact oriented surface with one
boundary component, we give an explicit formula for the action of Dehn twists
on the completed group ring of the fundamental group of the surface. This
invariant can be considered as ``the logarithms" of Dehn twists. The formula
generalizes the classical formula describing the action on the first homology
of the surface, and Morita's explicit computations of the extended first and
the second Johnson homomorphisms. For the proof we use a homological
interpretation of the Goldman Lie algebra in the framework of Kontsevich's
formal symplectic geometry. As an application, we prove the action of the Dehn
twist of a simple closed curve on the $k$-th nilpotent quotient of the
fundamental group of the surface depends only on the conjugacy class of the
curve in the $k$-th quotient.
