You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

messages.xml 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <chapter id="messages" xreflabel="Messages">
  2. <title>Messages</title>
  3. <sect1 id="messages-introduction">
  4. <title>Introduction</title>
  5. <para> By default only warning and error messages are issued by the compiler whether it is
  6. being used for source code compilation, weaving, binary weaving or load-time weaving. Informational,
  7. debug and weaving messages can also be obtained using compiler options
  8. or System properties. Also as well as being able to soften or ignore
  9. certain error messages the various <literal>-Xlint</literal>
  10. <ulink url="../devguide/ajc-ref.html">options</ulink> can be used to
  11. notify you of conditions that would otherwise be ignored. </para>
  12. <para> It is often difficult to determine, especially when using load-time weaving (LTW),
  13. why advice has not been woven. Here is a quick guide to the messages to
  14. look for. Firstly if you use the <literal>-verbose</literal> option you
  15. should see the following message when your aspect is registered: </para>
  16. <programlisting><![CDATA[
  17. info register aspect MyAspect
  18. ]]></programlisting>
  19. <para> Secondly if you use the <literal>-debug</literal> option you should
  20. see a message indicating that you class is being woven: </para>
  21. <programlisting><![CDATA[
  22. debug weaving 'HelloWorld'
  23. ]]></programlisting>
  24. <para> However this does not mean that advice has actually been woven into
  25. your class merely that the class has been passed to the weaver. So thirdly to determine
  26. whether your pointcuts match you can use the <literal>-showWeaveInfo</literal>
  27. option which will cause a message to be issued each time a piece of advice is woven: </para>
  28. <programlisting><![CDATA[
  29. weaveinfo Join point 'method-execution(void HelloWorld.main(java.lang.String[]))' ...
  30. ]]></programlisting>
  31. <sect2 id="configuration" xreflabel="configuration">
  32. <title>Configuration</title>
  33. <para> The table below lists the options used to control AspectJ messages. The method
  34. of configuration depends on your environment so refer to the relevant
  35. documentation for
  36. <ulink url="../devguide/ajc-ref.html">ajc</ulink>,
  37. <ulink url="../devguide/antTasks-iajc.html#antTasks-iajc-options">Ant</ulink> or
  38. <ulink url="../devguide/ltw-configuration.html#weaver-options">LTW</ulink>. </para>
  39. <informaltable>
  40. <tgroup cols="2">
  41. <thead>
  42. <row>
  43. <entry>Option</entry>
  44. <entry>Description</entry>
  45. </row>
  46. </thead>
  47. <tbody>
  48. <row>
  49. <entry>
  50. <literal>-verbose</literal>
  51. </entry>
  52. <entry>
  53. Show informational messages including AspectJ version
  54. and build date.
  55. </entry>
  56. </row>
  57. <row>
  58. <entry>
  59. <literal>-debug</literal>
  60. </entry>
  61. <entry>
  62. (Load-time weaving only). Show debugging messages such as
  63. which classes are being woven or those that are excluded.
  64. </entry>
  65. </row>
  66. <row>
  67. <entry>
  68. <literal>-showWeaveInfo</literal>
  69. </entry>
  70. <entry>
  71. Show weaving messages.
  72. </entry>
  73. </row>
  74. <row>
  75. <entry>
  76. <literal>-Xlint</literal>
  77. </entry>
  78. <entry>
  79. Control level of lint messages.
  80. </entry>
  81. </row>
  82. </tbody>
  83. </tgroup>
  84. </informaltable>
  85. <para> The table below lists some useful <literal>-Xlint</literal> messages. </para>
  86. <informaltable>
  87. <tgroup cols="3">
  88. <thead>
  89. <row>
  90. <entry>Message</entry>
  91. <entry>Default</entry>
  92. <entry>Description</entry>
  93. </row>
  94. </thead>
  95. <tbody>
  96. <row>
  97. <entry>
  98. <literal>aspectExcludedByConfiguration</literal>
  99. </entry>
  100. <entry>
  101. <literal>ignore</literal>
  102. </entry>
  103. <entry>
  104. If an aspect is not being woven, despite being
  105. registered, it could be that it has been excluded
  106. by either an <literal>include</literal> or <literal>exclude</literal>
  107. element in the
  108. <literal>aspects</literal> section of <literal>META-INF/aop.xml</literal>.
  109. Enable this message to determine whether an aspect has
  110. been excluded.
  111. </entry>
  112. </row>
  113. </tbody>
  114. </tgroup>
  115. </informaltable>
  116. <para> </para>
  117. </sect2>
  118. <sect2 id="examples" xreflabel="examples">
  119. <title>Examples</title>
  120. <para> You can use <literal>META-INF/aop.xml</literal> to control which
  121. messages are produced during LTW. The following example will produce
  122. basic informational messages about the lifecyle of the weaver in
  123. addition to any warning or error messages. </para>
  124. <programlisting><![CDATA[
  125. <aspectj>
  126. <weaver options="-verbose">
  127. </weaver>
  128. </aspectj>
  129. ]]></programlisting>
  130. <para> Notice that you are told exactly which <literal>META-INF/aop.xml</literal>
  131. configurations file(s) are being used. Each message is also preceeded by the
  132. name of the defining class loader associated with weaver. You can use this
  133. information in a large system to distinguish between different applications each
  134. of which will typically have its own class loader. </para>
  135. <programlisting><![CDATA[
  136. [AppClassLoader@92e78c] info AspectJ Weaver Version 1.5.3 built on Thursday Oct 26, 2006 at 17:22:31 GMT
  137. [AppClassLoader@92e78c] info register classloader sun.misc.Launcher$AppClassLoader@92e78c
  138. [AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop.xml
  139. [AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop-ajc.xml
  140. [AppClassLoader@92e78c] info register aspect ExceptionHandler
  141. [AppClassLoader@92e78c] info processing reweavable type ExceptionHandler: ExceptionHandler.aj
  142. ]]></programlisting>
  143. </sect2>
  144. </sect1>
  145. </chapter>