aboutsummaryrefslogtreecommitdiffstats
path: root/docs/pdGuideDB/messages.xml
blob: 44b1189bdca43d097044ad6d388fd2709f201726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<chapter id="messages" xreflabel="Messages">
    <title>Messages</title>
    
    <sect1 id="messages-introduction">
        <title>Introduction</title>
        
        <para> By default only warning and error messages are issued by the compiler whether it is
        being used for source code compilation, weaving, binary weaving or load-time weaving. Informational,
        debug and weaving messages can also be obtained using compiler options 
        or System properties. Also as well as being able to soften or ignore 
        certain error messages the various <literal>-Xlint</literal> 
        <ulink url="../devguide/ajc-ref.html">options</ulink> can be used to 
        notify you of conditions that would otherwise be ignored. </para>

		<para> It is often difficult to determine, especially when using load-time weaving (LTW),
		why advice has not been woven. Here is a quick guide to the messages to
		look for. Firstly if you use the <literal>-verbose</literal> option you 
		should see the following message when your aspect is registered: </para>

        <programlisting><![CDATA[
	info register aspect MyAspect
        ]]></programlisting>

		<para> Secondly if you use the <literal>-debug</literal> option you should 
		see a message indicating that you class is being woven: </para>

        <programlisting><![CDATA[
	debug weaving 'HelloWorld'
        ]]></programlisting>

		<para> However this does not mean that advice has actually been woven into
		your class merely that the class has been passed to the weaver. To determine
		whether your pointcuts match you can use the <literal>-showWeaveInfo</literal>
		option which will cause a message to be issued each time a piece of advice is woven: </para>

        <programlisting><![CDATA[
	weaveinfo Join point 'method-execution(void HelloWorld.main(java.lang.String[]))' ...
		]]></programlisting>

        <sect2 id="configuration" xreflabel="configuration">
            <title>Configuration</title>
            
            <para> The table below lists the options used to control AspectJ messages. The method
            of configuration depends on your environment so refer to the relevant 
            documentation for 
            <ulink url="../devguide/ajc-ref.html">ajc</ulink>, 
            <ulink url="../devguide/antTasks-iajc.html#antTasks-iajc-options">Ant</ulink> or 
            <ulink url="../devguide/ltw-configuration.html#weaver-options">LTW</ulink>. </para>
            <informaltable>
                <tgroup cols="2">
                    <thead>
                        <row>
                            <entry>Option</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>-verbose</literal>
                            </entry>
                            <entry>
                            	Show informational messages including AspectJ version
                            	and build date.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-debug</literal>
                            </entry>
                            <entry>
                            	(Load-time weaving only). Show debugging messages such as
                            	which classes are being woven or those that are excluded.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-showWeaveInfo</literal>
                            </entry>
                            <entry>
                            	Show weaving messages.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-Xlint</literal>
                            </entry>
                            <entry>
                            	Control level of lint messages.
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
            
            <para> The table below lists some useful <literal>-Xlint</literal> messages. </para>
            <informaltable>
                <tgroup cols="3">
                    <thead>
                        <row>
                            <entry>Message</entry>
                            <entry>Default</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>aspectExcludedByConfiguration</literal>
                            </entry>
                            <entry>
                                <literal>ignore</literal>
                            </entry>
                            <entry>
                            	If an aspect is not being woven, despite being
                            	registered, it could be that it has been excluded
                            	by either an <literal>include</literal> or <literal>exclude</literal> 
                            	element in the 
                            	<literal>aspects</literal> section of <literal>META-INF/aop.xml</literal>.
                            	Enable this message to determine whether an aspect has
                            	been excluded.
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
        
            <para>  </para>
        </sect2>

        <sect2 id="examples" xreflabel="examples">
            <title>Examples</title>
        
            <para> You can use <literal>META-INF/aop.xml</literal> to control which
            messages are produced during LTW. The following example will produce
            basic informational messages about the lifecyle of the weaver in
            addition to any warning or error messages. </para>

	        <programlisting><![CDATA[
	<aspectj>
		<weaver options="-verbose">
		</weaver>
	</aspectj>
			]]></programlisting>
        
            <para> Notice that you are told exactly which <literal>META-INF/aop.xml</literal> 
            configurations file(s) are being used. Each message is also preceeded by the 
            name of the defining class loader associated with weaver. You can use this
            information in a large system to distinguish between different applications each
            of which will typically have its own class loader. </para>

	        <programlisting><![CDATA[
[AppClassLoader@92e78c] info AspectJ Weaver Version 1.5.3 built on Thursday Oct 26, 2006 at 17:22:31 GMT
[AppClassLoader@92e78c] info register classloader sun.misc.Launcher$AppClassLoader@92e78c
[AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop.xml
[AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop-ajc.xml
[AppClassLoader@92e78c] info register aspect ExceptionHandler
[AppClassLoader@92e78c] info processing reweavable type ExceptionHandler: ExceptionHandler.aj
			]]></programlisting>
        </sect2>
    </sect1>
</chapter>