Improve Log File Readability Improving the readability of the log files helps users to find problems more quickly. Please incorporate the following recommendation to help improve log file readability. GlassFish implements a logging utility. Use that logging utility when providing information or error messages about the server or server processing. Developers should never use System.out or System.err even when providing debug information. Many times stack traces are useful and should be logged using the logging utility. Developers have the ability to use anonymous loggers if more convenient. All stack traces should be logged. Example below assumes that ex is an Exception object.
Logger.getAnonymousLogger().log(Level.WARNING, "Error occurred", ex);
The following modules use printStackTrace directly to print the stack traces.
Module Name |
Occurrences of printStackTrace in code |
Comments |
admin |
17 |
admin-cli |
8 |
increase week as of Aug 6 |
admin-util |
3 |
1 test |
amx-config-impl |
0 |
fixed all occurences 2009-0827 |
amx-core |
1 |
fixed all occurences 2009-0827 |
amx-core-impl |
0 |
fixed all occurences 2009-0827 |
amx-ext-impl |
0 |
fixed all occurences 2009-0827 |
amx-j2ee-impl |
0 |
fixed all occurences 2009-0827 |
annotation-framework |
3 |
cli-framework |
7 |
cli-optional |
5 |
one less as of Sept 22 |
cmp-ejb-mapping |
2 |
This is a command line tool that runs out side appserver. |
cmp-enhancer |
15 |
None of above code would be executed inside appserver |
cmp-model |
9 |
Defines a convenience method printStrackTrace on an exception class for JDO users. It never gets called inside appserver |
cmp-support-sqlstore |
2 |
Defines a convenience method printStrackTrace on an exception class for JDO users. It never gets called inside appserver |
cmp-utility |
1 |
This class is not active inside running appserver. |
common-util |
51 |
43 are from class Print.java which uses the string printStaceTrace through out, more investigation needed. |
config-api |
9 |
7 tests |
connectors-inbound-runtime |
0 |
as of Sept 22 |
connectors-internal-api |
9 |
one less as of Sept 22 |
connectors-runtime |
0 |
as of sept 22 |
console-common |
25 |
console-common-full-plugin |
2 |
console-core |
9 |
console-jms-plugin |
1 |
console-updatecenter-plugin |
10 |
container-common |
1 |
deployment-admin |
0 |
as of Aug 6 |
deployment-autodeploy |
0 |
as of Aug 6 |
deployment-client |
2 |
the remaining two occurrences are printing stack trace to printwriter/printstream |
deployment-common |
0 |
as of Aug 6 |
deployment-j2ee-full |
0 |
as of Aug 6 |
dol |
0 |
as of Aug 6 |
ejb-container |
16 |
4 tests |
ejb-internal-api |
9 |
ejb-timer-service-app |
1 |
extras |
42 |
8 tests |
flashlight-framework |
4 |
gf-client |
2 |
These are in the app client, not the server. One use is in the package-appclient utility which does not use a logger. The other is in a catch-all handler in the Java agent used during app client launches. |
gf-client-module |
7 |
These are in the app client, not the server. Further, all 7 occurrences are very early in the processing before the app client logger would be established. Some printStackTrace calls are to streams other than System.out or System.err to capture the stack trace for other purposes, such as formatting for a dialog box during Java Web Start launches. |
glassfish-api |
4 |
glassfish-mbeanserver |
10 |
glassfish-nameing |
6 |
glassfish-parent |
58 |
14 tests (in dir called testing) |
internal-api |
5 |
javax.ejb |
1 |
jdbc-core |
0 |
jms-admin |
9 |
jms-core |
7 |
jsr109-impl |
2 |
as of Aug 6 |
jta |
18 |
as of Aug 6 |
jts |
20 |
as of Aug 6 |
kernel |
35 |
4 commented out |
launcher |
2 |
mejb |
9 |
5 tests |
monitoring-core |
3 |
orb-iiop |
1 |
osgi-container |
1 |
registration-impl |
14 |
rest-service |
20 |
increase by 2 as of sept 22 |
security |
16 |
increase as of Aug 6 |
server-mgmt |
3 |
sun-javaee-engine |
31 |
transaction |
9 |
All tests |
utils |
1 |
verifier |
40 |
war-util |
0 |
as of Aug 6 |
web |
9 |
All test cases |
web-ajp |
13 |
Wholesale integration of source code from Apache |
web-core |
6 |
web-embed-impl |
1 |
new as of Sept 22 |
web-glue |
2 |
web-naming |
1 |
|