123 You can find more information on how to document Ant task using the Antdoclet plugin on http://antdoclet.neuroning.com/. |
123 You can find more information on how to document Ant task using the Antdoclet plugin on http://antdoclet.neuroning.com/. |
124 |
124 |
125 Logging |
125 Logging |
126 ------- |
126 ------- |
127 |
127 |
128 Developer must use standard Ant logging for any user log output. |
128 Developer must preferably use standard Ant logging for any user log output. |
129 Internal debug logging must be implemented using Log4J framework. |
129 Internal debug logging must be implemented using Log4J framework. |
|
130 |
|
131 * ANT Listeners must use log4j logging framework - using Ant logging system might cause some looping issues. |
|
132 * Ant Type and Task must use the Ant logging mechanism to report to the user. |
|
133 * Generic framework (part of the code which doesn't links to Ant directly) must use Log4J. |
|
134 * Usage of System.out.println should be avoided. |
|
135 * All the non-handled exceptions should be considered as errors and should be reported as such: |
|
136 * use log("message", Project.MSG_ERR) under Ant |
|
137 * log.error() otherwise. |
|
138 * Exception to this rule must be clearly commented under the code. |
|
139 * Debug information: |
|
140 * Log4J framework (log.debug()) must be used to push information to the Helium debug log - so debug information are not |
|
141 directly visible by the user. |
|
142 * Ant logging framework can also be use to log Type/Task debug info (but log4j is preferred). |
|
143 * PrintStackTrace method should be used on below scenario's: |
|
144 * At the time of unknown exception. |
|
145 * Should be used with exceptions other than BuildException. |
|
146 * In case it is difficult to debug the issue with Exception.getMessage(). |
|
147 * use this method during debugging complex issue (this doesn't mean the line should remain in the code after development). |
|
148 * When it is required to print the all the information about the occurring Exception. |
|
149 |
130 |
150 |
131 This is an example on how to use logging: |
151 This is an example on how to use logging: |
132 :: |
152 :: |
133 |
153 |
134 import org.apache.log4j.Logger; |
154 import org.apache.log4j.Logger; |
142 } |
162 } |
143 } |
163 } |
144 |
164 |
145 |
165 |
146 Please find more information on Log4J from the online manual: http://logging.apache.org/log4j/1.2/manual.html. |
166 Please find more information on Log4J from the online manual: http://logging.apache.org/log4j/1.2/manual.html. |
|
167 |
|
168 |
|
169 Exception |
|
170 --------- |
|
171 |
|
172 Exceptional event reporting and handling is crutial in software development. Developer must make sure it is done accordingly |
|
173 to the framework it is currently using: |
|
174 |
|
175 * To report a build failure under Ant the BuildException must be used. |
|
176 But we have to keep in mind that a BuildException is not tracked because it derives from the RuntimeError type. |
|
177 So we have to be careful with those and try to limit their puprose to the original usage: Ant build failure. |
|
178 * It is preferable to have meaningful exception type like: FileNotFoundException. |
|
179 * Developer should try to avoid as much as possible the throw or catch raw type of exception like Exception, RuntimeError. |
|
180 |