<chapter id="ajcore" xreflabel="AspectJ Core Files">
    <title>AspectJ Core Files</title>
    
    <sect1 id="ajcore-introduction">
        <title>Introduction</title>
        
        <para> When the compiler terminates abnormally, either because a particular kind of message was
        issued or an exception was thrown, an AspectJ core file will be produced. You will
        find it the working directory of the compiler and it will have a name that contains
        the date and time that the file was produced 
        e.g. <literal>ajcore.20060810.173655.626.txt</literal>. The file contains details
        of the problem such as the exception thrown as well as information about the
        environment such as operating system and Java version. When submitting a bug,
        include this file whenever it is available.</para>
            
        <sect2 id="configuration" xreflabel="configuration">
            <title>Configuring dump files</title>
            
            <para> By default AspectJ will only create an <literal>ajcore</literal> file 
            when an unexpected exception is thrown by the weaver or an 
            <literal>abort</literal> message is
            issued. However it is possible to disable this feature or enable files to
            be produced under different circumstances. The table below lists the System 
            properties that can be used to configure <literal>ajcore</literal> files. </para>
            <informaltable>
                <tgroup cols="3">
                    <thead>
                        <row>
                            <entry>Property</entry>
                            <entry>Default</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>org.aspectj.weaver.Dump.exception</literal>
                            </entry>
                            <entry>
                                <literal>true</literal>
                            </entry>
                            <entry>
                            	Generate an <literal>ajcore</literal> files when an exception thrown.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>org.aspectj.weaver.Dump.condition</literal>
                            </entry>
                            <entry>
                                <literal>abort</literal>
                            </entry>
                            <entry>
                            	Message kind for which to generate <literal>ajcore</literal>
                            	e.g. <literal>error</literal>. 
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>org.aspectj.dump.directory</literal>
                            </entry>
                            <entry>
                                <literal>none</literal>
                            </entry>
                            <entry>
                            	The directory used for ajcore files. 
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
  		</sect2>

        <sect2 id="ajcore-examples" xreflabel="AJCore File Examples">
            <title>AJCore File Examples</title>
        
            <para> Below is an extract from an <literal>ajcore</literal> file. You will see
            details of the dump configuration as well as the exception (with stack trace) that
            is the source of the problem and any messages issued by the compiler. Most importantly
            the exact version of AspectJ is included. </para>
	        <programlisting><![CDATA[
---- AspectJ Properties ---
AspectJ Compiler DEVELOPMENT built on Tuesday Jul 25, 2006 at 13:00:09 GMT
---- Dump Properties ---
Dump file: ajcore.20060810.173655.626.txt
Dump reason: java.lang.NoClassDefFoundError
Dump on exception: true
Dump at exit condition: abort
---- Exception Information ---
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
	at org.aspectj.weaver.tools.CommonsTraceFactory.<init>(CommonsTraceFactory.java:17)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:232)
	at org.aspectj.weaver.tools.TraceFactory.<clinit>(TraceFactory.java:35)
	at org.aspectj.weaver.World.<clinit>(World.java:114)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(AjBuildManager.java:679)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:224)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:164)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:367)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:246)
	at org.aspectj.tools.ajc.Main.main(Main.java:86)
---- System Properties ---
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path=C:\jdk1.3.1_16\jre\bin
java.vm.version=1.3.1_16-b06
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\workspaces\org.aspectj\org.aspectj.ant.tests
java.runtime.version=1.3.1_16-b06
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\IBM_user\LOCALS~1\Temp\
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
java.awt.fonts=
os.name=Windows XP
java.library.path=C:\jdk1.3.1_16\jre\bin;...
java.specification.name=Java Platform API Specification
java.class.version=47.0
os.version=5.1
user.home=C:\Documents and Settings\IBM_user
user.timezone=Europe/London
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=Cp1252
java.specification.version=1.3
java.class.path=C:\workspaces\org.aspectj\aj-build\dist\tools\lib\aspectjtools.jar
user.name=IBM_user
java.vm.specification.version=1.0
java.home=C:\jdk1.3.1_16\jre
user.language=en
java.specification.vendor=Sun Microsystems Inc.
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.3.1_16
java.ext.dirs=C:\jdk1.3.1_16\jre\lib\ext
sun.boot.class.path=C:\jdk1.3.1_16\jre\lib\rt.jar;...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding=UnicodeLittle
sun.cpu.endian=little
user.region=GB
sun.cpu.isalist=pentium i486 i386
---- Command Line ---
-d
C:\workspaces\org.aspectj\org.aspectj.ant.tests\IncrementalAjcTaskTest-temp
-g:none
-deprecation
-noExit
-warn:-unusedImport
-nowarn
-XterminateAfterCompilation
-preserveAllLocals
-proceedOnError
-referenceInfo
-source
1.3
-target
1.1
-time
-verbose
-classpath
C:\workspaces\org.aspectj\org.aspectj.ant.tests\..\lib\test\aspectjrt.jar
-argfile
C:\workspaces\org.aspectj\taskdefs\testdata\default.lst
-messageHolder
org.aspectj.bridge.MessageHandler
---- Full Classpath ---
Empty
---- Compiler Messages ---
abort ABORT -- (NoClassDefFoundError) org/apache/commons/logging/LogFactory
org/apache/commons/logging/LogFactory
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
	at org.aspectj.weaver.tools.CommonsTraceFactory.<init>(CommonsTraceFactory.java:17)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:232)
	at org.aspectj.weaver.tools.TraceFactory.<clinit>(TraceFactory.java:35)
	at org.aspectj.weaver.World.<clinit>(World.java:114)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(AjBuildManager.java:679)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:224)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:164)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:367)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:246)
	at org.aspectj.tools.ajc.Main.main(Main.java:86)
			]]></programlisting>
            
        </sect2>
    </sect1>
</chapter>
