Search code examples
sqlhaskellloggingyesod

How to disable debug SQL logs in Yesod development mode


Is it possible to disable [Debug#SQL] logs when running Yesod application in development with yesod devel?


Solution

  • Look for something like this in Application.hs

     pool <-
        flip runLoggingT logFunc $
          createPostgresqlPool
            (pgConnStr $ appDatabaseConf appSettings)
            (pgPoolSize $ appDatabaseConf appSettings)
    

    and replace it with something like this

    pool <-
        runNoLoggingT $
          createPostgresqlPool
            (pgConnStr $ appDatabaseConf appSettings)
            (pgPoolSize $ appDatabaseConf appSettings)
    

    Using runNoLoggingT monad transformer is the key to make it work. You can also change the logging settings for migrations if you wish. As you can see, the application uses postgreSQL.