Basically I have a normal Java app, with a main. I use Intelij Ultimate. I have the following pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>88</groupId>
<artifactId>SpaceX</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/aspectj/aspectjrt -->
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
So I also have a LoggingAspect which I just cant figure out how to run. I tried this too http://confluence.jetbrains.com/display/~roman.shevchenko/AspectJ+Support+Plugin
And manually downloaded the jar but I also downloaded the Intelij plugins for Aspects. Like AspectJ Support and Spring Aspect.
My aspect class looks like this:
public aspect LoggingAspect {
pointcut tracing():call(public * com.company..*.*(..)) && !within(LoggingAspect);
private Logger logger= Logger.getLogger("com.company");
public LoggingAspect() {
PropertyConfigurator.configure("logging.properties");
}
before(): tracing(){
logger.info("Entering: "+ thisJoinPointStaticPart.getSignature());
}
after():tracing(){
logger.info("Exiting: "+ thisJoinPointStaticPart.getSignature());
}
}
As you can see. I want to use the java.util.logging.Logger
and I have a logging.properties file where I set up the output file. I tried compiling the app like in the link I pasted above, running the app normally, nothing seems to be working. My aspect is not working at all/ it's not being used. Any advice? Am I missing something?
I dont want to use Spring Aspect with annotations yet. I can't figure out how to make this one work first
I changed my compiler to ajc and tested the connection, everything is fine. I have added Aspectjrt to dependencies... it still doesn't do anything when I try to run the program. It just runs normaly without applying the aspects. Any ideas?