Wiki source code of Programming__WebObjects-EOF-Using EOF-Logging
Version 2.1 by smmccraw on 2007/07/08 09: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 | {{panel}} | ||
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 | {{/panel}} | ||
22 | |||
23 | This can be useful for such things as determining what fetches are performed when a page is rendered: | ||
24 | |||
25 | |||
26 | {{panel}} | ||
27 | |||
28 | public void appendToResponse(WOResponse aResponse, | ||
29 | WOContext aContext) { | ||
30 | logSQL(true); | ||
31 | super.appendToResponse(aResponse, aContext); | ||
32 | logSQL(false); | ||
33 | } | ||
34 | |||
35 | {{/panel}} | ||
36 | |||
37 | Category:WebObjects |