Reputation: 4127
I have a simple hello world happstack app:
module Main where
import Happstack.Server (nullConf, simpleHTTP, toResponse, ok)
main :: IO ()
main = simpleHTTP nullConf $ ok "Hello, World!"
I want it to log requests to stdout.
I found this http://happstack.wordpress.com/2009/02/26/happstack-now-outputs-apache-combined-logs/ which says it is outputting logs, but they are not going to stdout. I've never used hslogger before and am having trouble figuring how to a) configure it, and b) wire it into happstack. nullConf
provides a default logMAccess
, but it isn't clear how that ends up in hslogger.
Upvotes: 3
Views: 354
Reputation: 4127
Just after I posted I found this: http://www.haskell.org/pipermail/beginners/2011-August/008184.html which gave me the clue I needed.
module Main where
import Happstack.Server (nullConf, simpleHTTP, toResponse, ok)
import System.IO
import System.Log.Logger ( updateGlobalLogger
, rootLoggerName
, setLevel
, Priority(..)
)
main :: IO ()
main = do
updateGlobalLogger rootLoggerName (setLevel INFO)
simpleHTTP nullConf $ ok "Hello, World!"
Upvotes: 3