log-files.dita 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <concept id="loghandling">
  5. <title>Log files</title>
  6. <shortdesc>When you run the DITA-OT, key information is logged on the screen. This information can also be written to
  7. a log file. If you encounter a problem, you can analyze this information to determine the source of the problem and
  8. then take action to resolve it.</shortdesc>
  9. <conbody>
  10. <p>The logging behavior varies depending on whether you use the <cmdname>dita</cmdname> command or Ant to invoke a
  11. toolkit build.</p>
  12. <dl>
  13. <dlentry>
  14. <dt><cmdname>dita</cmdname> command</dt>
  15. <dd>By default, only warning and error messages are written to the screen. If you use the
  16. <parmname>-v</parmname> option, logging will be more verbose and informative messages are also written out.
  17. The <parmname>-l</parmname> option can be used to write the log messages into a file.</dd>
  18. </dlentry>
  19. <dlentry>
  20. <dt>Ant</dt>
  21. <dd>By default, status information is written to the screen. If you issue the <parmname>-l</parmname> parameter,
  22. the build runs silently and the information is written to a log file with the name and location that you
  23. specified.</dd>
  24. </dlentry>
  25. </dl>
  26. <section>
  27. <title>Using other Ant loggers</title>
  28. <p>You also can use other Ant loggers; see
  29. <xref href="https://ant.apache.org/manual/listeners.html" format="html" scope="external">Listeners &amp;
  30. Loggers</xref> in the Ant documentation for more information.</p>
  31. <p>For example, you can use the <b>AnsiColorLogger</b> to colorize the messages written on the screen.</p>
  32. <dl>
  33. <dlentry>
  34. <dt><cmdname>dita</cmdname> command</dt>
  35. <dd>
  36. <p>To use a custom Ant logger with the <cmdname>dita</cmdname> command, add the logger to the
  37. <codeph>ANT_ARGS</codeph> environment variable by calling the following command before calling the
  38. <cmdname>dita</cmdname> command:</p>
  39. <codeblock>export ANT_ARGS="-logger org.apache.tools.ant.listener.AnsiColorLogger"</codeblock>
  40. <p>Now you will get colorized messages when the <cmdname>dita</cmdname> command runs.</p>
  41. <note type="tip">Environment variables can also be set permanently. See
  42. <xref href="https://www.java.com/en/download/help/path.xml" format="html" scope="external">How do I set or
  43. change the PATH system variable?</xref> for information on how to set the <codeph>PATH</codeph>
  44. environment variable. You can set the <codeph>ANT_ARGS</codeph> environment variable in the same
  45. way.</note>
  46. </dd>
  47. </dlentry>
  48. <dlentry>
  49. <dt>Ant</dt>
  50. <dd>
  51. <p>If you prefer to launch the DITA-OT directly from Ant, you can also add the logger to the
  52. <codeph>ANT_ARGS</codeph> environment variable, as explained above. You can also set the logger with the
  53. <codeph>-logger</codeph> parameter when calling Ant.</p>
  54. <codeblock>ant -logger org.apache.tools.ant.listener.AnsiColorLogger</codeblock>
  55. </dd>
  56. </dlentry>
  57. </dl>
  58. </section>
  59. <!--<section><title>Analyze messages on the screen</title><p>During the building process, some information or messages
  60. occur on the screen to tell you about the status, warnings, errors, or fatal errors. You need to analyze the
  61. messages to solve the problems. <ul>
  62. <li>If the build succeeded with some warning messages on the screen, it means that there are something
  63. incorrect within the user input parameters or source DITA files; but you can still get the correct
  64. output.</li>
  65. <li>If the build succeeded with some error messages on the screen, it means that there are something incorrect
  66. within the user input parameters or source DITA files; the output maybe not correct.</li>
  67. <li>If the build failed with fatal error message on the screen, it means that there are something illegal or
  68. invalid within the user input parameters or source DITA files; you may get no output, or wrong output.</li>
  69. </ul>
  70. </p></section>-->
  71. <!--<section><title>Analyze messages in the log file</title><p>A log file in plain text format is generated in the log
  72. directory, which has a name combined with both input file name and transformation type. You can open it and find more
  73. detailed information, which are helpful for solving problems. You can use the same way introduced above to
  74. analyze the messages and solve the problems.</p><p>The log directory can be specified by:</p><ul>
  75. <li>using Ant, with argument <codeph>-logfile=<userinput>log-file</userinput></codeph></li>
  76. <li>using command-line tool, the parameter <codeph>/logdir:<userinput>log-dir</userinput></codeph>.</li>
  77. </ul></section>-->
  78. <!--<section><title>Turn on debug mode</title><p>Under debug mode, diagnostic information, such as: environment
  79. variables, stack trace, will be logged into the log file. These information can help the user or developer to go
  80. deep into the problems and find the root cause.</p><p>By default, the debug mode is disabled. To turn on the
  81. debug mode on, you need to follow the usage below: <ul>
  82. <li>Append <codeph>-v</codeph> and <codeph>-Dargs.debug=yes</codeph> in Ant command.</li>
  83. <li>Append <codeph>/d</codeph> or <codeph>/debug</codeph> in command-line tool.</li>
  84. </ul></p></section>-->
  85. </conbody>
  86. </concept>