log-files.dita 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 DITA-OT, key information is logged on the screen. This information can also be written to a
  7. 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. <prolog>
  10. <metadata>
  11. <keywords>
  12. <indexterm>Apache FOP<indexterm>log files</indexterm></indexterm>
  13. <indexterm><cmdname>dita</cmdname> command<indexterm>logging</indexterm></indexterm>
  14. <indexterm>logging</indexterm>
  15. <indexterm>Ant<indexterm>logging</indexterm></indexterm>
  16. <indexterm>debugging<index-see-also>logging</index-see-also></indexterm>
  17. <indexterm>Java<indexterm>logging</indexterm></indexterm>
  18. </keywords>
  19. </metadata>
  20. </prolog>
  21. <conbody>
  22. <p>The logging behavior varies depending on whether you use the <cmdname>dita</cmdname> command or Ant to invoke a
  23. toolkit build.</p>
  24. <dl>
  25. <dlentry>
  26. <dt><cmdname>dita</cmdname> command</dt>
  27. <dd>By default, only warning and error messages are written to the screen. If you use the
  28. <parmname>-v</parmname> option, logging will be more verbose and informative messages are also written out.
  29. The <parmname>-l</parmname> option can be used to write the log messages into a file.</dd>
  30. </dlentry>
  31. <dlentry>
  32. <dt>Ant</dt>
  33. <dd>By default, status information is written to the screen. If you issue the <parmname>-l</parmname> parameter,
  34. the build runs silently and the information is written to a log file with the name and location that you
  35. specified.</dd>
  36. </dlentry>
  37. </dl>
  38. <section>
  39. <title>Using other Ant loggers</title>
  40. <p>You also can use other Ant loggers; see
  41. <xref href="https://ant.apache.org/manual/listeners.html" format="html" scope="external">Listeners &amp;
  42. Loggers</xref> in the Ant documentation for more information.</p>
  43. <p>For example, you can use the <b>AnsiColorLogger</b> to colorize the messages written on the screen.</p>
  44. <dl>
  45. <dlentry>
  46. <dt><cmdname>dita</cmdname> command</dt>
  47. <dd>
  48. <p>To use a custom Ant logger with the <cmdname>dita</cmdname> command, add the logger to the
  49. <codeph>ANT_ARGS</codeph> environment variable by calling the following command before calling the
  50. <cmdname>dita</cmdname> command:</p>
  51. <codeblock>export ANT_ARGS="-logger org.apache.tools.ant.listener.AnsiColorLogger"</codeblock>
  52. <p>Now you will get colorized messages when the <cmdname>dita</cmdname> command runs.</p>
  53. <note type="tip">Environment variables can also be set permanently. See
  54. <xref href="https://www.java.com/en/download/help/path.xml" format="html" scope="external">How do I set or
  55. change the PATH system variable?</xref> for information on how to set the <codeph>PATH</codeph>
  56. environment variable. You can set the <codeph>ANT_ARGS</codeph> environment variable in the same
  57. way.</note>
  58. </dd>
  59. </dlentry>
  60. <dlentry>
  61. <dt>Ant</dt>
  62. <dd>
  63. <p>If you prefer to launch DITA-OT directly from Ant, you can also add the logger to the
  64. <codeph>ANT_ARGS</codeph> environment variable, as explained above. You can also set the logger with the
  65. <codeph>-logger</codeph> parameter when calling Ant.</p>
  66. <codeblock>ant -logger org.apache.tools.ant.listener.AnsiColorLogger</codeblock>
  67. </dd>
  68. </dlentry>
  69. </dl>
  70. </section>
  71. <section>
  72. <title>FOP debug logging</title>
  73. <div outputclass="div-index">
  74. <indexterm>logback.xml</indexterm>
  75. <indexterm>classpath<indexterm>logging</indexterm></indexterm>
  76. </div>
  77. <p>In PDF processing with <tm trademark="Apache" tmtype="tm">Apache</tm> FOP, DITA-OT 3.1 now uses the Simple
  78. Logging Facade for Java (SLF4J), allowing for better control and formatting of FOP log messages. To reduce noise
  79. on the console, all FOP messages are set to the Info level and hidden by default.</p>
  80. <p>To enable debug logging, modify the <filepath>config/logback.xml</filepath> file or add your own
  81. <filepath>logback.xml</filepath> to the classpath with a higher priority to override the default settings. For
  82. more information, see the
  83. <xref href="https://logback.qos.ch/manual/configuration.html" format="html" scope="external">Logback
  84. configuration documentation</xref>.</p>
  85. <note type="attention">Enabling FOP debug logging will dramatically increase the size of generated log
  86. files.</note>
  87. </section>
  88. <!--<section><title>Analyze messages on the screen</title><p>During the building process, some information or messages
  89. occur on the screen to tell you about the status, warnings, errors, or fatal errors. You need to analyze the
  90. messages to solve the problems. <ul>
  91. <li>If the build succeeded with some warning messages on the screen, it means that there are something
  92. incorrect within the user input parameters or source DITA files; but you can still get the correct
  93. output.</li>
  94. <li>If the build succeeded with some error messages on the screen, it means that there are something incorrect
  95. within the user input parameters or source DITA files; the output maybe not correct.</li>
  96. <li>If the build failed with fatal error message on the screen, it means that there are something illegal or
  97. invalid within the user input parameters or source DITA files; you may get no output, or wrong output.</li>
  98. </ul>
  99. </p></section>-->
  100. <!--<section><title>Analyze messages in the log file</title><p>A log file in plain text format is generated in the log
  101. directory, which has a name combined with both input file name and transformation type. You can open it and find more
  102. detailed information, which are helpful for solving problems. You can use the same way introduced above to
  103. analyze the messages and solve the problems.</p><p>The log directory can be specified by:</p><ul>
  104. <li>using Ant, with argument <codeph>-logfile=<userinput>log-file</userinput></codeph></li>
  105. <li>using command-line tool, the parameter <codeph>/logdir:<userinput>log-dir</userinput></codeph>.</li>
  106. </ul></section>-->
  107. <!--<section><title>Turn on debug mode</title><p>Under debug mode, diagnostic information, such as: environment
  108. variables, stack trace, will be logged into the log file. These information can help the user or developer to go
  109. deep into the problems and find the root cause.</p><p>By default, the debug mode is disabled. To turn on the
  110. debug mode on, you need to follow the usage below: <ul>
  111. <li>Append <codeph>-v</codeph> and <codeph>-Dargs.debug=yes</codeph> in Ant command.</li>
  112. <li>Append <codeph>/d</codeph> or <codeph>/debug</codeph> in command-line tool.</li>
  113. </ul></p></section>-->
  114. </conbody>
  115. </concept>