log_format.qbk 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. [/
  2. / Copyright (c) 2003 Boost.Test contributors
  3. /
  4. / Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. /]
  7. [section:log_formats Log formats]
  8. The __UTF__ supports several log formats:
  9. * [link boost_test.test_output.log_formats.log_human_readable_format HRF]: human readable format
  10. * [link boost_test.test_output.log_formats.log_xml_format XML]: an machine interpretable log format
  11. * [link boost_test.test_output.log_formats.log_junit_format JUNIT]: a standardized log format
  12. understandable by automated tools such as Continuous Builds
  13. [h4 Design]
  14. The following functionalities are supported by the logging framework:
  15. * each logger manages its own log level. The rationale is that some log format are meant for
  16. automated processing, and by design need to carry all the information that will later be digested
  17. by a visualization tool.
  18. * several log format may be active at the same time. The rationale is that the user might want to
  19. see a non-exhaustive log in his terminal using a human friendly format, while having a detailed
  20. full log in a file with a format dedicated to automated processing.
  21. * each logger /indicates/ its default output stream. some logger may prefer to output to one of the standard
  22. stream while other may prefer output to a file.
  23. [note The logger indicates the default output stream in case the default should be used. ]
  24. [h4 Defaults]
  25. By default the active log level threshold is set to
  26. * [link boost_test.test_output.log_formats.test_log_output "non fatal error messages"] and the test log output
  27. is generated in [link boost_test.test_output.log_formats.log_human_readable_format human readable format].
  28. * [link boost_test.test_output.log_formats.test_log_output "general information"] for
  29. [link boost_test.test_output.log_formats.log_junit_format JUNIT] log format
  30. The active log level threshold and the output format can be configured
  31. at runtime during a test module invocation and at compile time from within a test module using the
  32. [link boost_test.test_output.logging_api test log public interfaces]. The behavior is logger specific though.
  33. [/ -------------------------------------------------------------------------------------------------- ]
  34. [section Test log output]
  35. The test log is produced during the test execution. All entries in the test log are assigned a particular log
  36. level. Only the entries with level that exceeds the ['active log level threshold] actually
  37. appear in the test log output. Log levels are arranged by the 'importance' of the log entries. Here is
  38. the list of all levels in order of increasing 'importance':
  39. [#test_log_output_table]
  40. [table:id_messages Messages
  41. [
  42. [Notifications]
  43. [Meaning]
  44. ]
  45. [
  46. [Success]
  47. [This category includes messages that provide information on successfully passed assertions]
  48. ]
  49. [
  50. [Test tree traversal]
  51. [This category includes messages that are produced by the __UTF__ core and indicate which test suites/cases are currently being executed or skipped]
  52. ]
  53. [
  54. [General information]
  55. [This category includes general information messages produced in most cases by a test module author using the
  56. macro __BOOST_TEST_MESSAGE__]
  57. ]
  58. [
  59. [Warning]
  60. [This category includes messages produced by failed `WARNING` level assertions]
  61. ]
  62. [
  63. [Non fatal error]
  64. [This category includes messages produced by failed `CHECK` level assertions]
  65. ]
  66. [
  67. [Uncaught C++ exceptions]
  68. [This category includes messages that are produced by the __UTF__ and provide detailed information on the C++
  69. exceptions uncaught by the test case body.
  70. ]
  71. ]
  72. [
  73. [Non-fatal system error]
  74. [This category includes messages that are produced by the __UTF__ itself and provides information about caught
  75. non-fatal system error. For example it includes messages produced in the case of test case timeout or if
  76. floating point values calculation errors are caught.
  77. ]
  78. ]
  79. [
  80. [Fatal system error]
  81. [This category includes messages produced by failed require level assertions and by the __UTF__ itself in case of
  82. abnormal test case termination.]
  83. ]
  84. ]
  85. [note
  86. The active log level works namely as threshold, not as selector. For the given active log level threshold, all
  87. test log entries with ['importance] higher than threshold are enabled and all test log entries with
  88. ['importance] below threshold are disabled.
  89. ]
  90. In addition to the levels described above the test log defines two special log levels. The current log level can
  91. be set to:
  92. * All messages[br]
  93. If active log level threshold is set to this value, all test log entries appear in the output. In practice
  94. this is equivalent to setting the active log level threshold to ['success information messages]
  95. * Nothing[br]
  96. If the active log level threshold is set to this value, none of test log entries appear in the output. This log level
  97. is used to execute a ['silent] test that doesn't produce any test log and only generates a result code indicating
  98. whether test failed or passed.
  99. [endsect] [/ test log output]
  100. [section:log_human_readable_format HRF: Human readable log format]
  101. The human readable log format is designed to closely match an errors description produced by the Microsoft family
  102. of C++ compilers. This format allows jumping to the error location, if test module output is redirected into IDE
  103. output window. The rest of the log messages are designed to produce the most human friendly description of the
  104. events occurring in test module. This is a default format generated by test modules.
  105. Here the list of events along with corresponding message and the condition that has to be satisfied for it to appear
  106. in the output.
  107. [table
  108. [
  109. [Event]
  110. [Condition]
  111. [Output]
  112. ]
  113. [ [On testing start]
  114. [threshold != log_nothing]
  115. [`Running <total number of test cases> test case(s) ...`] ]
  116. [ [On testing start]
  117. [threshold != log_nothing, show_build_info is set]
  118. [
  119. [pre Platform: $BOOST_PLATFORM
  120. Compiler: $BOOST_COMPILER
  121. STL : $BOOST_STDLIB
  122. Boost : $BOOST_VERSION]] ]
  123. [ [On abnormal testing termination]
  124. [threshold <= log_messages]
  125. [`Test is aborted`] ]
  126. [ [On test unit start]
  127. [threshold <= log_test_units]
  128. [`Entering test <test unit type> <test unit name>`] ]
  129. [ [On test unit end]
  130. [threshold <= log_test_units; testing time is reported only if elapsed time is more than 1 us.]
  131. [`Leaving test <test unit type> <test unit name>; testing time <value>`] ]
  132. [ [On skipped test unit]
  133. [threshold <= log_test_units]
  134. [`Test <test unit type> <test unit name> is skipped`] ]
  135. [ [On uncaught C++ exception]
  136. [threshold <= log_cpp_exception_errors. Checkpoint message is reported only if provided]
  137. [`unknown location(0): fatal error in <test case name>: <explanation> <last checkpoint location>: last checkpoint: <checkpoint message>`] ]
  138. [ [On resumable system error]
  139. [threshold <= log_system_errors. Checkpoint message is reported only if provided]
  140. [`unknown location(0): fatal error in <test case name>: <explanation> <last checkpoint location>: last checkpoint: <checkpoint message>`] ]
  141. [ [On fatal system error]
  142. [threshold <= log_fatal_errors. Checkpoint message is reported only if provided]
  143. [`unknown location(0): fatal error in <test case name>: <explanation> <last checkpoint location>: last checkpoint: <checkpoint message>`] ]
  144. [ [On passed test assertion]
  145. [threshold <= log_successful_tests]
  146. [`<assertion location>: info: check<assertion expression> passed`] ]
  147. [ [On failed WARNING level test assertion]
  148. [threshold <= log_warnings]
  149. [`<assertion location>: warning in <test case name>: condition <assertion description> is not satisfied`]]
  150. [ [On failed CHECK level test assertion]
  151. [threshold <= log_all_errors]
  152. [`<assertion location>: error in <test case name>: check <assertion description> failed`] ]
  153. [ [On failed REQUIRE level test assertion]
  154. [threshold <= log_fatal_errors]
  155. [`<assertion location>: fatal error in <test case name>: critical check <assertion description> failed`]]
  156. [ [On test log message]
  157. [threshold <= log_messages]
  158. [`<Message content>`]]
  159. ]
  160. The level of details concerning the error message depends on the [link boost_test.testing_tools testing tool] producing the log entry.
  161. [endsect] [/ human readable report]
  162. [/ -------------------------------------------------------------------------------------------------- ]
  163. [section:log_xml_format XML log format]
  164. This log format is designed for automated test results processing. The test log output XML schema depends on the
  165. active log level threshold.
  166. [endsect] [/section:log_xml_format ]
  167. [/ -------------------------------------------------------------------------------------------------- ]
  168. [section:log_junit_format JUNIT log format]
  169. The [@http://junit.org/ JUNIT format] is log format supported by a wide range of Continuous Build/Integration tools.
  170. This format defaults its log level to [link test_log_output_table `General information`] and its default stream to a file named after
  171. [link boost_test.tests_organization.test_tree.master_test_suite master test suite].
  172. The logger will attempt to not overwrite any existing output file, which is also usually understood by Continuous Build tools.
  173. This format is in fact both a log and a report format: most of the Continuous Build tools will summarize
  174. the content of a JUNIT file and show an overview of the failing/succeeding tests of a module (report format)
  175. while letting the user inspect the detailed logs (log format).
  176. [caution The minimal log-level for the JUnit logger is [link test_log_output_table `non fatal error`].
  177. Any set-up to higher log level will default to that minimal log-level.]
  178. [note Until Boost 1.64, the log level was previously defaulting to `success` and was causing a heavy load
  179. on the logging part in some circumstances.]
  180. [endsect] [/section:log_junit_format ]
  181. [endsect]