Wiki source code of Programming__WebObjects-EOF-Using EOF-Logging
Version 3.1 by Quinton Dolan on 2007/07/09 07:08
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == Overview == | ||
| 2 | |||
| 3 | You can turn SQL logging on when launching by using --DEOAdaptorDebugEnabled=true or EOAdaptorDebugEnabled YES. However, this can slam out a ton of SQL. While this is useful for some debugging it is way too much to sift through when trying to analyze a particular problem.-- | ||
| 4 | |||
| 5 | You can use this method to selectively enable and disable SQL logging: | ||
| 6 | |||
| 7 | {{code}} | ||
| 8 | |||
| 9 | public static void logSQL(boolean shouldLog) { | ||
| 10 | if (shouldLog) { | ||
| 11 | NSLog.allowDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration | | ||
| 12 | NSLog.DebugGroupDatabaseAccess | | ||
| 13 | NSLog.DebugGroupEnterpriseObjects); | ||
| 14 | } else { | ||
| 15 | NSLog.refuseDebugLoggingForGroups(NSLog.DebugGroupSQLGeneration | | ||
| 16 | NSLog.DebugGroupDatabaseAccess | | ||
| 17 | NSLog.DebugGroupEnterpriseObjects); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | {{/code}} | ||
| 22 | |||
| 23 | This can be useful for such things as determining what fetches are performed when a page is rendered: | ||
| 24 | |||
| 25 | |||
| 26 | {{code}} | ||
| 27 | |||
| 28 | public void appendToResponse(WOResponse aResponse, | ||
| 29 | WOContext aContext) { | ||
| 30 | logSQL(true); | ||
| 31 | super.appendToResponse(aResponse, aContext); | ||
| 32 | logSQL(false); | ||
| 33 | } | ||
| 34 | |||
| 35 | {{/code}} | ||
| 36 | |||
| 37 | Category:WebObjects |