Closed solonovamax closed 4 months ago
It seems that you can add a logger to all transactions by doing the following:
// An example with current available settings and their defaults
val dbConfig = DatabaseConfig {
sqlLogger = Slf4jSqlDebugLogger
useNestedTransactions = false
defaultFetchSize = null // unlimited
defaultIsolationLevel = -1 // DB specific
defaultRepetitionAttempts = 3
warnLongQueriesDuration = null // no long query tracing
maxEntitiesToStoreInCachePerEntity = Int.MAX_VALUE // unlimited
keepLoadedReferencesOutOfTransaction = false
}
// databaseConfig available on each connect/connectPool functions
val database = Database.connect(datasource, databaseConfig = databaseConfig)
see: 0.35.1 Release Notes
I don' think we need this :thinking: If you only care about a development mode, you can just comment out this line:
And you'll get all statements from Exposed in debug mode.
@dzikoysk it was more for diagnosing an issue
but it'd be nice to not have to recompile it in order to see the debug logs
Request details
Currently, debug mode will log all requests, but not all sql statements. It would be nice if they could be logged as well.
I'm currently attempting to debug an issue with some sql stuff, and I had to make a custom build to get this. It would be nice to have this enabled with debug mode.
you can add a debug logger to a transaction using:
this will log to stdout using the format:
Alternatively, if you want to implement a custom logger that uses your logging framework (bc ik you use a custom one), you can do so by copying the implementation from
StdOutSqlLogger
:the reason I'm having to debug some issues is bc I went and deleted a bunch of shit with
in order to remove some testing things that were making my stats out of proportion, but that's a whole other thing lol