| 1 | | | <body> |
| 2 | | | |
| 3 | | | <section> |
| 4 | | | <title>Logging Formatter</title> |
| 5 | | | <p>This section provides a comprehensive architectural overview |
| 6 | | | of the FawkeZ LogFormatter, and how it could be integrated |
| 7 | | | into a Java Application environment. It describes the format of |
| 8 | | | how log messages are presented and how this fits into CA Unicenter |
| 9 | | | requirements and gives an overview of related tools.</p> |
| 10 | | | |
| 11 | | | <section> |
| 12 | | | <title>Integration into The Java Logging API</title> |
| 13 | | | <p>A Logger uses a Handler for publishing a LogRecord. |
| 14 | | | The LogRecord encapsulates all kinds of information, |
| 15 | | | the location where it was logged, the message text, |
| 16 | | | parameters for the message, thread id, etc.</p> |
| 17 | | | |
| 18 | | | <p>The Handler uses a Formatter for converting all this |
| 19 | | | information into a human readable string. The FawkeZ |
| 20 | | | LogFormatter is an implementation of such a Formatter. |
| 21 | | | The diagram below sketches an overview of this collaboration. |
| 22 | | | For further information see the API documentation of the Java |
| 23 | | | SDK classes in the <classname>java.util.logging package.</classname></p> |
| 24 | | | |
| 25 | | | <figure> |
| 26 | | | <title>Collaboration of the main Java logging classes</title> |
| 27 | | | <img src="images/logging-collaboration.svg"/> |
| 28 | | | </figure> |
| 29 | | | </section> |
| 30 | | | |
| 31 | | | <section> |
| 32 | | | <title>Log format</title> |
| 33 | | | <p>This chapter specifies the log format and lists significant |
| 34 | | | goals of this format.</p> |
| 35 | | | |
| 36 | | | <section> |
| 37 | | | <title>Goals and Constraints</title> |
| 38 | | | <p>The Log Format is based upon the following goals: |
| 39 | | | <ul> |
| 40 | | | <li>Text based format to allow viewing the log file |
| 41 | | | without special tools.</li> |
| 42 | | | <li>Allow usage of Unix standard tools for filtering |
| 43 | | | messages out of log files like <classname>grep</classname> and |
| 44 | | | <classname>tail</classname>.</li> |
| 45 | | | <li>Meet requirements of CA Unicenter.</li> |
| 46 | | | <li>Put as much information as possible into the log file</li> |
| 47 | | | <li>Present the data human readable even without having |
| 48 | | | to use any tool.</li> |
| 49 | | | </ul> |
| 50 | | | </p> |
| 51 | | | </section> |
| 52 | | | |
| 53 | | | <section> |
| 54 | | | <title>Overview</title> |
| 55 | | | <p>In general, a <classname>LogRecord</classname> is split into |
| 56 | | | several lines of text containing line specific information. |
| 57 | | | The line starts with a character denoting the type of the |
| 58 | | | current line. The output is slightly different between |
| 59 | | | Trace Logs and Message Logs. |
| 60 | | | In case of Message Logs the output contains always the stack |
| 61 | | | trace to enable thorough analysis of the log file.</p> |
| 62 | | | </section> |
| 63 | | | |
| 64 | | | <section> |
| 65 | | | <title>Log fields</title> |
| 66 | | | <p>The following presents the fields being logged and the |
| 67 | | | format used for logging the appropriate field. |
| 68 | | | Log Lines are composed of these fields, in general with |
| 69 | | | blanks as delimiters.</p> |
| 70 | | | |
| 71 | | | <informaltable frame='none'> |
| 72 | | | <tgroup cols='2' align='left' colsep='0' rowsep='0'> |
| 73 | | | <tbody> |
| 74 | | | <row><entry>Log line type</entry><entry>A single character that |
| 75 | | | defines the type of the current log line.</entry></row> |
| 76 | | | <row> |
| 77 | | | <entry>Timestamp</entry><entry>Gives the time in |
| 78 | | | UTC in the Format |
| 79 | | | <classname>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</classname>, for example |
| 80 | | | <classname>2005-05-19T11:35:06.547Z</classname></entry></row> |
| 81 | | | <row> |
| 82 | | | <entry>Node Id</entry><entry>Fix length of 15 chars, |
| 83 | | | left padded with blanks.</entry></row> |
| 84 | | | <row><entry>Instance Id</entry><entry>Fix length of 8 chars, |
| 85 | | | right padded with blanks.</entry></row> |
| 86 | | | <row><entry>Thread Id</entry><entry>Fix length of 5, |
| 87 | | | left padded with blanks.</entry></row> |
| 88 | | | <row><entry>Level</entry><entry>Fix length 8, |
| 89 | | | right padded with blanks</entry></row> |
| 90 | | | <row><entry>Symbol Id</entry><entry>symbolic id of the message, |
| 91 | | | in general hex string, fix length 8, left padded |
| 92 | | | with blanks</entry></row> |
| 93 | | | <row><entry>BusinessImpact</entry><entry>One of Critical, |
| 94 | | | Major, Middle, Minor, None, Undefined. |
| 95 | | | Fix length 9, right padded with blanks</entry></row> |
| 96 | | | <row><entry>ThreadName / Category</entry><entry>This entry has been |
| 97 | | | changed. It was One of Audit, Business, |
| 98 | | | Flow, Security, Technical, Undefined. |
| 99 | | | And is now changed to the last 9 characters of the thread name. |
| 100 | | | In case of a ordinary log record the the name of the logger |
| 101 | | | thread is used. This might be wrong in certain setups but is |
| 102 | | | correct in many cases. The fawkeZ loggable records the |
| 103 | | | thread name of the thread that created the loggable instance |
| 104 | | | which is the correct thread name in all cases. |
| 105 | | | Fix length 9, right padded with blanks. |
| 106 | | | </entry></row> |
| 107 | | | <row><entry>Tracking Number</entry><entry>Unique number of |
| 108 | | | the log message, hex string. Fix length 8, left |
| 109 | | | padded with 0.</entry></row> |
| 110 | | | <row><entry>Sequence Of TrackingNumbers</entry><entry>The Log |
| 111 | | | format supports nesting of log messages. |
| 112 | | | In some log lines the tracking numbers are logged |
| 113 | | | as sequence of tracking numbers of all nested log |
| 114 | | | messages, which are known when logging the line. |
| 115 | | | So with every nested log message this sequence increases. |
| 116 | | | It consists of elements of format Tracking Number |
| 117 | | | delimited by the char sequence ???>-???.</entry></row> |
| 118 | | | </tbody> |
| 119 | | | </tgroup> |
| 120 | | | </informaltable> |
| 121 | | | </section> |
| 122 | | | |
| 123 | | | <section> |
| 124 | | | <title>Log line types</title> |
| 125 | | | <p>The following presents the types of log lines, the |
| 126 | | | appropriate type code and the fields the log line is composed of. |
| 127 | | | The type code is the first character of the log line followed |
| 128 | | | by a blank followed by the fields specific for the line.</p> |
| 129 | | | |
| 130 | | | <section> |
| 131 | | | <title>Trace line</title> |
| 132 | | | <p>Type code <classname>'T???</classname>. |
| 133 | | | This is the first line of a trace log. It consists of |
| 134 | | | the following fields, in this order, delimited by blanks: |
| 135 | | | <ul> |
| 136 | | | <li>Timestamp Format</li> |
| 137 | | | <li>Node Id</li> |
| 138 | | | <li>Instance Id</li> |
| 139 | | | <li>Thread Id</li> |
| 140 | | | <li>Level</li> |
| 141 | | | <li>Symbol Id</li> |
| 142 | | | <li>Business Impact</li> |
| 143 | | | <li>ThreadName (was Category)</li> |
| 144 | | | <li>Tracking Number</li> |
| 145 | | | <li>Log Source in the format classname.methodname()</li> |
| 146 | | | <li>Parameters as formatted list</li> |
| 147 | | | <li>Message text</li> |
| 148 | | | </ul> |
| 149 | | | </p> |
| 150 | | | </section> |
| 151 | | | |
| 152 | | | <section> |
| 153 | | | <title>Exception line</title> |
| 154 | | | <p>Type code <classname>???F???</classname>. This is equal |
| 155 | | | to a trace line and used if the trace log was logged |
| 156 | | | with an exception</p> |
| 157 | | | </section> |
| 158 | | | |
| 159 | | | <section> |
| 160 | | | <title>Message line</title> |
| 161 | | | <p>Type code <classname>???M???</classname>. This is logged |
| 162 | | | in case of Message Logs. It consists of the following fields: |
| 163 | | | <ul> |
| 164 | | | <li>Timestamp Format</li> |
| 165 | | | <li>Node Id</li> |
| 166 | | | <li>Instance Id</li> |
| 167 | | | <li>Thread Id</li> |
| 168 | | | <li>Level</li> |
| 169 | | | <li>Symbol Id</li> |
| 170 | | | <li>Business Impact</li> |
| 171 | | | <li>ThreadName (was Category)</li> |
| 172 | | | <li>Sequence of TrackingNumbers</li> |
| 173 | | | <li>Formatted message text</li> |
| 174 | | | </ul> |
| 175 | | | </p> |
| 176 | | | </section> |
| 177 | | | |
| 178 | | | <section> |
| 179 | | | <title>Error line</title> |
| 180 | | | <p>Type code <classname>???E???</classname>. |
| 181 | | | This is logged in case of Message Logs if the Loggable |
| 182 | | | has as cause an exception other than another instance |
| 183 | | | of Loggable and has the same format as a Message Line</p> |
| 184 | | | </section> |
| 185 | | | |
| 186 | | | <section> |
| 187 | | | <title>Parameter line</title> |
| 188 | | | <p>Type code <classname>???P???</classname>. |
| 189 | | | This contains the parameters given in a Message log and |
| 190 | | | consists of the following fields: |
| 191 | | | <ul> |
| 192 | | | <li>Thread Id</li> |
| 193 | | | <li>Sequence of Tracking Numbers</li> |
| 194 | | | <li>Parameter Name, delimited by |
| 195 | | | <classname>": \t"</classname> from the next field</li> |
| 196 | | | <li>List of parameter values in the format</li> |
| 197 | | | <li><classname>[value1,value2,?]</classname> with |
| 198 | | | all <classname>','</classname> and |
| 199 | | | <classname>']'</classname> chars in the |
| 200 | | | values escaped.</li> |
| 201 | | | </ul> |
| 202 | | | </p> |
| 203 | | | </section> |
| 204 | | | |
| 205 | | | <section> |
| 206 | | | <title>Nested line</title> |
| 207 | | | <p>Type code <classname>???N???</classname>. |
| 208 | | | A line of this type is logged when there is a cause |
| 209 | | | for a log message. It consists of the following fields: |
| 210 | | | <ul> |
| 211 | | | <li>Thread Id</li> |
| 212 | | | <li>Sequence of Tracking Numbers</li> |
| 213 | | | <li>"Caused by: "</li> |
| 214 | | | <li>One of Exception text in case the cause is |
| 215 | | | not a Loggable or Message symbol in case |
| 216 | | | the cause is a Loggable</li> |
| 217 | | | </ul> |
| 218 | | | </p> |
| 219 | | | </section> |
| 220 | | | |
| 221 | | | <section> |
| 222 | | | <title>Stack trace line</title> |
| 223 | | | <p>Type code <classname>???S???</classname>. |
| 224 | | | This type of line is used when the stack trace of |
| 225 | | | <classname>Loggables</classname> or |
| 226 | | | <classname>Throwables</classname> is logged. |
| 227 | | | It consists of the fields: |
| 228 | | | <ul> |
| 229 | | | <li>Thread Id</li> |
| 230 | | | <li>Sequence of Tracking Numbers</li> |
| 231 | | | <li>One of "Caused by: " followed by exception message or |
| 232 | | | " at " followed by classname.methodname</li> |
| 233 | | | <li><classname>?????????</classname> followed by number |
| 234 | | | followed by <classname>??? more???</classname></li> |
| 235 | | | </ul> |
| 236 | | | </p> |
| 237 | | | </section> |
| 238 | | | </section> |
| 239 | | | |
| 240 | | | <section> |
| 241 | | | <title>Composition of log lines</title> |
| 242 | | | |
| 243 | | | <p>This section describes how the LogLines are composed for a formatted |
| 244 | | | LogRecord. There are some slight differences between TraceLogs and |
| 245 | | | MessageLogs.</p> |
| 246 | | | |
| 247 | | | <section> |
| 248 | | | <title>Trace log composition</title> |
| 249 | | | |
| 250 | | | <p>In case of a trace log we have the following composition of log |
| 251 | | | lines: |
| 252 | | | |
| 253 | | | Either a single line of log line type 'T' |
| 254 | | | <pre> |
| 255 | | | T 2005-08-28T10:12:58.520Z 10.64.4.103 P6c7e483c 10 INFO TRA [...]</pre> |
| 256 | | | |
| 257 | | | or a single line of log line type 'F' followed by the log line |
| 258 | | | type 'N' for every nested throwable and additional lines of the |
| 259 | | | log line type 'S'. |
| 260 | | | |
| 261 | | | <pre> |
| 262 | | | F 2005-08-28T10:12:57.655Z 10.64.4.103 P6c7e483c 10 SEVERE TRA [...] |
| 263 | | | N 10 00000002 Caused by: java.lang.Exception: This is a top level tes [...] |
| 264 | | | S 10 00000002 java.lang.Exception: This is a top level test exception [...] |
| 265 | | | S 10 00000002 at org.jcoderz.commons.LogFormatterOutputTest.testLog [...] |
| 266 | | | [...] |
| 267 | | | S 10 00000002 at org.apache.tools.ant.taskdefs.optional.junit.JUnit [...]</pre> |
| 268 | | | </p> |
| 269 | | | </section> |
| 270 | | | |
| 271 | | | <section> |
| 272 | | | <title>Message Log Composition</title> |
| 273 | | | |
| 274 | | | <p>In case of a message log we have the following composition of log |
| 275 | | | lines: |
| 276 | | | |
| 277 | | | A single line of either the log line type 'E' or 'M' followed by |
| 278 | | | at least three lines <footnote><p>The log source line |
| 279 | | | "classname.method(line)", the message symbol and solution text is |
| 280 | | | always logged as log line type 'P' (parameters)</p></footnote> |
| 281 | | | with the log line type 'P'. |
| 282 | | | After all the nested elements are logged, log lines of |
| 283 | | | type ???S??? for the top level and every nested element. |
| 284 | | | |
| 285 | | | <pre> |
| 286 | | | M 2005-08-28T10:12:57.367Z 10.64.4.103 P6c7e483c 10 INFO 200 [...] |
| 287 | | | P 10 e15f4df4 _SYMBOL_: [FWK_TST_TEST_MESSAGE] [...] |
| 288 | | | P 10 e15f4df4 _SOLUTION_: [This is the solution of the test message. [...] |
| 289 | | | P 10 e15f4df4 _LOGGED_AT_: [org.jcoderz.commons.LogFormatterOutput [...] |
| 290 | | | P 10 e15f4df4 NOW: [Sun Aug 28 12:12:57 CEST 2005] |
| 291 | | | P 10 e15f4df4 FOO: [foo] |
| 292 | | | S 10 e15f4df4 FWK_TST_TEST_MESSAGE |
| 293 | | | S 10 e15f4df4 at org.jcoderz.commons.TstLogMessage$TestMessage.log( [...] |
| 294 | | | [...] |
| 295 | | | S 10 e15f4df4 at org.apache.tools.ant.taskdefs.optional.junit.JUnit [...]</pre> |
| 296 | | | for a nested Throwable, a log line type 'N' |
| 297 | | | <pre> |
| 298 | | | E 2005-08-28T10:12:57.693Z 10.64.4.103 P6c7e483c 10 SEVERE 101 [...] |
| 299 | | | P 10 f63e719c _SYMBOL_: [FWK_RTE_INTERNAL_ERROR] |
| 300 | | | P 10 f63e719c _SOLUTION_: [Review the log file to determine the prob [...] |
| 301 | | | P 10 f63e719c _LOGGED_AT_: [org.jcoderz.commons.LogFormatterOutput [...] |
| 302 | | | P 10 f63e719c TECHNICAL_DESCRIPTION: [dump stack trace w/ nested Nu [...] |
| 303 | | | N 10 f63e719c Caused by: java.lang.NullPointerException |
| 304 | | | S 10 f63e719c FWK_RTE_INTERNAL_ERROR |
| 305 | | | S 10 f63e719c at org.jcoderz.commons.LogFormatterOutputTest.testSer [...] |
| 306 | | | [...] |
| 307 | | | S 10 f63e719c at org.apache.tools.ant.taskdefs.optional.junit.JUnit [...] |
| 308 | | | S 10 f63e719c Caused by: java.lang.NullPointerException |
| 309 | | | S 10 f63e719c ...17 more</pre> |
| 310 | | | |
| 311 | | | or for a nested Loggable, a log line type 'N' followed by a line |
| 312 | | | of the log line type 'M' or 'E', followed by the log line type 'P' |
| 313 | | | as described above. |
| 314 | | | <pre> |
| 315 | | | F 2005-08-28T10:13:30.215Z 10.64.4.103 P6c7e483c 10 FINER TRA [...] |
| 316 | | | N 10 0000051e>-c2472cd8 Caused by: FWK_RTE_ARGUMENT_MALFORMED |
| 317 | | | E 2005-08-28T10:13:30.215Z 10.64.4.103 P6c7e483c 10 FINER 101 [...] |
| 318 | | | P 10 0000051e>-c2472cd8 _SYMBOL_: [FWK_RTE_ARGUMENT_MALFORMED] |
| 319 | | | P 10 0000051e>-c2472cd8 _SOLUTION_: [Supply a correct value for th [...] |
| 320 | | | P 10 0000051e>-c2472cd8 _LOGGED_AT_: [org.jcoderz.commons.types [...] |
| 321 | | | P 10 0000051e>-c2472cd8 ARGUMENT_NAME: [FooToken] |
| 322 | | | P 10 0000051e>-c2472cd8 ARGUMENT_VALUE: [FOO=BAR00000000000001\,T=C [...] |
| 323 | | | P 10 0000051e>-c2472cd8 HINT: [The Foo Token must consist of three [...] |
| 324 | | | S 10 0000051e>-c2472cd8 FWK_RTE_ARGUMENT_MALFORMED |
| 325 | | | S 10 0000051e>-c2472cd8 at org.jcoderz.commons.types.FooToken [...] |
| 326 | | | [...] |
| 327 | | | S 10 0000051e>-c2472cd8 at org.apache.tools.ant.taskdefs.optional.j [...]</pre> |
| 328 | | | </p> |
| 329 | | | </section> |
| 330 | | | </section> |
| 331 | | | </section> |
| 332 | | | <section> |
| 333 | | | <title>Constraints and Restrictions</title> |
| 334 | | | |
| 335 | | | <section> |
| 336 | | | <title>White space Normalization</title> |
| 337 | | | |
| 338 | | | <p>The log format depends heavily on the log line type code at the |
| 339 | | | start of the log line and that it contains all the fields belonging to |
| 340 | | | the specific line. Therefore it is not possible to log messages, which |
| 341 | | | contains line separators. So the LogFormatter normalizes all white |
| 342 | | | space in the following way: |
| 343 | | | <ul> |
| 344 | | | <li>The blank char ???\u0020??? is left untouched.</li> |
| 345 | | | <li>All other white space characters are compressed to |
| 346 | | | one blank char.</li> |
| 347 | | | </ul> |
| 348 | | | </p> |
| 349 | | | </section> |
| 350 | | | |
| 351 | | | <section> |
| 352 | | | <title>Parameter Names</title> |
| 353 | | | <p>A parameter name must not include white space.</p> |
| 354 | | | </section> |
| 355 | | | </section> |
| 356 | | | |
| 357 | | | <section> |
| 358 | | | <title>Log Formatter</title> |
| 359 | | | |
| 360 | | | <section> |
| 361 | | | <title>Overview</title> |
| 362 | | | |
| 363 | | | <p>The <classname>LogFormatter</classname> can logically be divided |
| 364 | | | into three main layers. The <classname>LogFormatter</classname> class |
| 365 | | | itself acts as line composer, that is it takes the information from a |
| 366 | | | <classname>LogRecord</classname> and decomposes it into several line |
| 367 | | | types. For each type of line it uses a specialized line formatter, |
| 368 | | | which just creates one or several lines of the corresponding lines. So |
| 369 | | | for example the formatter for line type ???N??? creates one line for each |
| 370 | | | supplied nested element, the formatter for line type ???S??? formats the |
| 371 | | | stack trace of one element in one go, produces therefore several lines. |
| 372 | | | A line formatter itself uses field formatters for creating a log line. |
| 373 | | | Both the line and field formatters could be used as parsers as well |
| 374 | | | capable of parsing just the information they have been formatted.</p> |
| 375 | | | </section> |
| 376 | | | |
| 377 | | | <section> |
| 378 | | | <title>Implementation View</title> |
| 379 | | | |
| 380 | | | <p>This section provides a view on the most important classes |
| 381 | | | participating in the functionality of the LogFormatter. There is the |
| 382 | | | LogFormatter itself, a class within the package |
| 383 | | | <classname>org.jcoderz.commons</classname>. It uses classes within the |
| 384 | | | package <classname>org.jcoderz.commons.logging</classname>, namely |
| 385 | | | implementations of |
| 386 | | | <classname>org.jcoderz.commons.logging.LogLineFormat</classname>. Each |
| 387 | | | such implementation uses implementations of |
| 388 | | | <classname>java.text.Format</classname> as formatter for a field of the |
| 389 | | | log line.</p> |
| 390 | | | |
| 391 | | | |
| 392 | | | <diagram type="class" name="logformat"> |
| 393 | | | <class name="org.jcoderz.commons.LogFormatter"/> |
| 394 | | | <class name="org.jcoderz.commons.logging.LogLineFormat"/> |
| 395 | | | <description> |
| 396 | | | Class diagram of the LogFormatter and LogLineFormatter. |
| 397 | | | </description> |
| 398 | | | </diagram> |
| 399 | | | |
| 400 | | | <diagram type="class" name="loglineformatter1"> |
| 401 | | | <class name="org.jcoderz.commons.logging.LogLineFormat"/> |
| 402 | | | <class name="org.jcoderz.commons.logging.BasicLogLineFormat"/> |
| 403 | | | <class name="org.jcoderz.commons.logging.MessageLineFormat"/> |
| 404 | | | <class name="org.jcoderz.commons.logging.ErrorLineFormat"/> |
| 405 | | | <class name="org.jcoderz.commons.logging.TraceLineFormat"/> |
| 406 | | | <class name="org.jcoderz.commons.logging.ExceptionLineFormat"/> |
| 407 | | | <description> |
| 408 | | | Class diagram of the different log line formatters (part 1). |
| 409 | | | </description> |
| 410 | | | </diagram> |
| 411 | | | |
| 412 | | | <diagram type="class" name="loglineformatter2"> |
| 413 | | | <class name="org.jcoderz.commons.logging.LogLineFormat"/> |
| 414 | | | <class name="org.jcoderz.commons.logging.ContinuationLineFormat"/> |
| 415 | | | <class name="org.jcoderz.commons.logging.NestedLineFormat"/> |
| 416 | | | <class name="org.jcoderz.commons.logging.ParameterLineFormat"/> |
| 417 | | | <description> |
| 418 | | | Class diagram of the different log line formatters (part 2). |
| 419 | | | </description> |
| 420 | | | </diagram> |
| 421 | | | |
| 422 | | | <diagram type="class" name="logfieldformatter1"> |
| 423 | | | <class name="org.jcoderz.commons.logging.AsItIsFormat"/> |
| 424 | | | <class name="org.jcoderz.commons.logging.CollectionFormat"/> |
| 425 | | | <class name="org.jcoderz.commons.logging.FixLengthFormat"/> |
| 426 | | | <description> |
| 427 | | | Class diagram of the different log field formatters (part 1). |
| 428 | | | </description> |
| 429 | | | </diagram> |
| 430 | | | |
| 431 | | | <diagram type="class" name="logfieldformatter2"> |
| 432 | | | <class name="org.jcoderz.commons.logging.StringEscapeFormat"/> |
| 433 | | | <class name="org.jcoderz.commons.logging.TimestampFormat"/> |
| 434 | | | <class name="org.jcoderz.commons.logging.WhitespaceFormat"/> |
| 435 | | | <description> |
| 436 | | | Class diagram of the different log field formatters (part 2). |
| 437 | | | </description> |
| 438 | | | </diagram> |
| 439 | | | </section> |
| 440 | | | |
| 441 | | | <section> |
| 442 | | | <title>Deployment View</title> |
| 443 | | | |
| 444 | | | <p>This Deployment View shows the requirements for using the FawkeZ |
| 445 | | | LogFormatter.</p> |
| 446 | | | |
| 447 | | | <section> |
| 448 | | | <title>Classpath</title> |
| 449 | | | |
| 450 | | | <p>All the classes required for using the LogFormatter are bundled |
| 451 | | | in a single jar file named common-logging.jar. This jar file must be |
| 452 | | | included in the classpath of any Java application using the |
| 453 | | | LogFormatter. In the case of a J2EE application the jar file must be |
| 454 | | | on the classpath of the J2EE server application.</p> |
| 455 | | | </section> |
| 456 | | | |
| 457 | | | <section> |
| 458 | | | <title>Enabling the LogFormatter</title> |
| 459 | | | |
| 460 | | | <p>The Java Logging API is configured with means of a properties |
| 461 | | | file or a configuration class. In this section only the properties |
| 462 | | | file is considered. For more information see the API documentation |
| 463 | | | of <classname>java.util.logging.LogManager</classname> and other |
| 464 | | | classes within the same package. A Formatter is set for an |
| 465 | | | implementation of a Handler, which publishes LogRecords. So it is |
| 466 | | | specific to the handler how it is configured to use a certain |
| 467 | | | Formatter. The following is an example how it is set for the |
| 468 | | | FileHandler within the logging properties file. |
| 469 | | | |
| 470 | | | <pre> |
| 471 | | | java.util.logging.FileHandler.formatter = org.jcoderz.commons.LogFormatter</pre> |
| 472 | | | </p> |
| 473 | | | |
| 474 | | | </section> |
| 475 | | | </section> |
| 476 | | | |
| 477 | | | <section> |
| 478 | | | <title>API Documentation</title> |
| 479 | | | |
| 480 | | | <apidoc name="logformatterapi"> |
| 481 | | | <class name="org.jcoderz.commons.LogFormatter"/> |
| 482 | | | <class name="org.jcoderz.commons.logging.LogLineFormat"/> |
| 483 | | | </apidoc> |
| 484 | | | </section> |
| 485 | | | </section> |
| 486 | | | |
| 487 | | | <section> |
| 488 | | | <title>LogViewer</title> |
| 489 | | | |
| 490 | | | <p> |
| 491 | | | </p> |
| 492 | | | |
| 493 | | | <refentry id="LogViewer"> |
| 494 | | | <refmeta> |
| 495 | | | <refentrytitle>LogViewer</refentrytitle> |
| 496 | | | <manvolnum>1</manvolnum> |
| 497 | | | </refmeta> |
| 498 | | | |
| 499 | | | <refnamediv> |
| 500 | | | <refname>LogViewer</refname> |
| 501 | | | <refpurpose>tool for viewing existing log files</refpurpose> |
| 502 | | | </refnamediv> |
| 503 | | | |
| 504 | | | <refsynopsisdiv> |
| 505 | | | <cmdsynopsis> |
| 506 | | | <command>LogViewer</command> |
| 507 | | | <arg choice='opt' rep='repeat'>OPTIONS</arg> |
| 508 | | | </cmdsynopsis> |
| 509 | | | |
| 510 | | | <refsect1> |
| 511 | | | <title>Description</title> |
| 512 | | | <para>The LogViewer is a stand-alone Java application in |
| 513 | | | the package <classname>org.jcoderz.commons.logging</classname>. |
| 514 | | | All required internal classes are include within the fawkez.jar file. |
| 515 | | | </para> |
| 516 | | | |
| 517 | | | <para> |
| 518 | | | The LogViewer uses external classes for parsing command lines |
| 519 | | | options and for object pooling. |
| 520 | | | The required packages are the following: |
| 521 | | | <itemizedlist> |
| 522 | | | <listitem> |
| 523 | | | <para>org.apache.commons.cli, which is supplied by a |
| 524 | | | <classname>commons-cli-nn.jar</classname> file with <token>nn</token> |
| 525 | | | denoting the version (currently 1.0).</para> |
| 526 | | | </listitem> |
| 527 | | | <listitem> |
| 528 | | | <para>org.apache.commons.pool, which is supplied by a |
| 529 | | | <classname>commons-pool-nn.jar</classname> file with <token>nn</token> |
| 530 | | | denoting the version (currently 1.2). |
| 531 | | | </para> |
| 532 | | | </listitem> |
| 533 | | | </itemizedlist> |
| 534 | | | |
| 535 | | | If the log viewer is used for converting a log file into an xml file, then jaxb runtime classes a required additionally. |
| 536 | | | </para> |
| 537 | | | |
| 538 | | | <p>The following commandline demonstrates how the LogViewer can |
| 539 | | | be started in a shell (bash). The Java Virtual Machine |
| 540 | | | (<classname>java</classname>) must be on the <classname>PATH</classname>. |
| 541 | | | |
| 542 | | | <pre> |
| 543 | | | $ java -classpath fawwkez.jar:commons-cli-1.0.jar:commons-pool-1.2.jar \ |
| 544 | | | org.jcoderz.commons.logging.LogViewer \ |
| 545 | | | --standard \ |
| 546 | | | --logDir /path/to/log \ |
| 547 | | | --logFile application.log0 |
| 548 | | | </pre> |
| 549 | | | </p> |
| 550 | | | |
| 551 | | | </refsect1> |
| 552 | | | |
| 553 | | | <refsect1> |
| 554 | | | <title>Options</title> |
| 555 | | | |
| 556 | | | |
| 557 | | | <variablelist> |
| 558 | | | <varlistentry> |
| 559 | | | <term><option>-d</option></term> |
| 560 | | | <term><option>--date </option> |
| 561 | | | <parameter class='command'>{[dateFrom], [dateTo]}</parameter> |
| 562 | | | </term> |
| 563 | | | <listitem> |
| 564 | | | <para>display date and search for given date/timestamp range. |
| 565 | | | The following date formats are supported: |
| 566 | | | <token><<varname>yyyy-MM-dd</varname> |
| 567 | | | | <varname>yyyy-MM-dd'T'HH:mm:ss'Z'</varname> |
| 568 | | | | <varname>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</varname>>. |
| 569 | | | </token> |
| 570 | | | One of both dates may be omitted.</para> |
| 571 | | | </listitem> |
| 572 | | | </varlistentry> |
| 573 | | | </variablelist> |
| 574 | | | |
| 575 | | | |
| 576 | | | <variablelist> |
| 577 | | | <varlistentry> |
| 578 | | | <term><option>-s</option></term> |
| 579 | | | <term><option>--standard</option> |
| 580 | | | </term> |
| 581 | | | <listitem> |
| 582 | | | <para>set standard mode, same as <option>-t</option> |
| 583 | | | <option>-i</option> |
| 584 | | | <option>-c</option> |
| 585 | | | <option>-L</option> |
| 586 | | | <option>-stack 1</option></para> |
| 587 | | | </listitem> |
| 588 | | | </varlistentry> |
| 589 | | | </variablelist> |
| 590 | | | |
| 591 | | | |
| 592 | | | <variablelist> |
| 593 | | | <varlistentry> |
| 594 | | | <term><option>-D</option></term> |
| 595 | | | <term><option>--logDir</option> |
| 596 | | | <parameter class='command'>{PATH}</parameter> |
| 597 | | | </term> |
| 598 | | | <listitem> |
| 599 | | | <para>find log files within <filename>PATH</filename> |
| 600 | | | instead of <filename>./log</filename></para> |
| 601 | | | </listitem> |
| 602 | | | </varlistentry> |
| 603 | | | </variablelist> |
| 604 | | | |
| 605 | | | |
| 606 | | | <variablelist> |
| 607 | | | <varlistentry> |
| 608 | | | <term><option>-F</option></term> |
| 609 | | | <term><option>--logFile</option> |
| 610 | | | <parameter class='command'>{FILE}</parameter> |
| 611 | | | </term> |
| 612 | | | <listitem> |
| 613 | | | <para>open file <filename>FILE</filename> instead |
| 614 | | | of <filename>log.out</filename>.</para> |
| 615 | | | </listitem> |
| 616 | | | </varlistentry> |
| 617 | | | </variablelist> |
| 618 | | | |
| 619 | | | |
| 620 | | | <variablelist> |
| 621 | | | <varlistentry> |
| 622 | | | <term><option>-L</option></term> |
| 623 | | | <term><option>--level</option> |
| 624 | | | <parameter><arg choice="req" rep="repeat">LEVEL</arg></parameter> |
| 625 | | | </term> |
| 626 | | | <listitem> |
| 627 | | | <para>display log level and filter for given levels</para> |
| 628 | | | </listitem> |
| 629 | | | </varlistentry> |
| 630 | | | </variablelist> |
| 631 | | | |
| 632 | | | |
| 633 | | | <variablelist> |
| 634 | | | <varlistentry> |
| 635 | | | <term><option>-T</option></term> |
| 636 | | | <term><option>--thread</option> |
| 637 | | | <parameter><arg choice="req" rep="repeat">THREAD_ID</arg></parameter> |
| 638 | | | </term> |
| 639 | | | <listitem> |
| 640 | | | <para>display thread id and filter for given thread ids</para> |
| 641 | | | </listitem> |
| 642 | | | </varlistentry> |
| 643 | | | </variablelist> |
| 644 | | | |
| 645 | | | |
| 646 | | | <variablelist> |
| 647 | | | <varlistentry> |
| 648 | | | <term><option>-b</option></term> |
| 649 | | | <term><option>--batch </option></term> |
| 650 | | | <listitem> |
| 651 | | | <para>batch mode, terminate if the end of the log |
| 652 | | | file is reached.</para> |
| 653 | | | </listitem> |
| 654 | | | </varlistentry> |
| 655 | | | </variablelist> |
| 656 | | | |
| 657 | | | |
| 658 | | | <variablelist> |
| 659 | | | <varlistentry> |
| 660 | | | <term><option>-c</option></term> |
| 661 | | | <term><option>--cat</option> |
| 662 | | | <parameter><arg choice="req" rep="repeat">CATEGORY</arg></parameter> |
| 663 | | | </term> |
| 664 | | | <listitem> |
| 665 | | | <para>display category and filter for given categories</para> |
| 666 | | | </listitem> |
| 667 | | | </varlistentry> |
| 668 | | | </variablelist> |
| 669 | | | |
| 670 | | | |
| 671 | | | <variablelist> |
| 672 | | | <varlistentry> |
| 673 | | | <term><option>-i</option></term> |
| 674 | | | <term><option>--impact</option> |
| 675 | | | <parameter><arg choice="req" rep="repeat">IMPACT</arg></parameter> |
| 676 | | | </term> |
| 677 | | | <listitem> |
| 678 | | | <para>display business impact and filter for |
| 679 | | | given business impact ids</para> |
| 680 | | | </listitem> |
| 681 | | | </varlistentry> |
| 682 | | | </variablelist> |
| 683 | | | |
| 684 | | | |
| 685 | | | <variablelist> |
| 686 | | | <varlistentry> |
| 687 | | | <term><option>-o</option></term> |
| 688 | | | <term><option>--outFile</option> |
| 689 | | | <parameter class='command'>{FILE}</parameter> |
| 690 | | | </term> |
| 691 | | | <listitem> |
| 692 | | | <para>send output to <filename>FILE</filename> instead of |
| 693 | | | <filename>stdout</filename></para> |
| 694 | | | </listitem> |
| 695 | | | </varlistentry> |
| 696 | | | </variablelist> |
| 697 | | | |
| 698 | | | |
| 699 | | | <variablelist> |
| 700 | | | <varlistentry> |
| 701 | | | <term><option>-stack</option> |
| 702 | | | <parameter>{0|1|2}</parameter> |
| 703 | | | </term> |
| 704 | | | <listitem> |
| 705 | | | <para>display stack trace details; |
| 706 | | | <literal>0</literal>: no stacktrace; |
| 707 | | | <literal>1</literal>: only for exceptions (default)</para> |
| 708 | | | </listitem> |
| 709 | | | </varlistentry> |
| 710 | | | </variablelist> |
| 711 | | | |
| 712 | | | |
| 713 | | | <variablelist> |
| 714 | | | <varlistentry> |
| 715 | | | <term><option>-t</option></term> |
| 716 | | | <term><option>--timestamp</option></term> |
| 717 | | | <listitem> |
| 718 | | | <para>display timestamp</para> |
| 719 | | | </listitem> |
| 720 | | | </varlistentry> |
| 721 | | | </variablelist> |
| 722 | | | |
| 723 | | | |
| 724 | | | <variablelist> |
| 725 | | | <varlistentry> |
| 726 | | | <term><option>-xml</option></term> |
| 727 | | | <listitem> |
| 728 | | | <para>output in XML format instead of text</para> |
| 729 | | | </listitem> |
| 730 | | | </varlistentry> |
| 731 | | | </variablelist> |
| 732 | | | </refsect1> |
| 733 | | | </refsynopsisdiv> |
| 734 | | | </refentry> |
| 735 | | | </section> |
| 736 | | | |
| 737 | | | </section> |
| 738 | | | |
| 739 | | | </body> |