Wiki source code of EOF-Using EOF-Logging
Version 4.1 by Pascal Robert on 2007/09/03 13:44
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 | {{code}} | ||
26 | |||
27 | public void appendToResponse(WOResponse aResponse, | ||
28 | WOContext aContext) { | ||
29 | logSQL(true); | ||
30 | super.appendToResponse(aResponse, aContext); | ||
31 | logSQL(false); | ||
32 | } | ||
33 | |||
34 | {{/code}} |