Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n
AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #73693] Wed, 01 April 2009 20:00 Go to next message
Pierre8r is currently offline Pierre8r
Messages: 10
Registered: July 2009
Junior Member
Hello,

OS Windows XP
EDI Eclipse 3.4.1
AspectJ version: 1.6.4.20090304172355


http://www.manning.com/laddad/
I take the code source from :
http://www.manning-source.com/books/laddad/laddad_src_Aspect j-In-Action.zip
Reconfigure it to do a Eclipse ready :
Here the new zip :
http://cjoint.com/?edvUgUpaLP

If I change nothing at the log4j.properties file, everything seen OK.

log4j.properties file

log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout

Output :
Entering [usingLog4jToolkit.Test.main]
Entering [usingLog4jToolkit.Inventory.<init>]
Entering [usingLog4jToolkit.Item.<init>]
Entering [usingLog4jToolkit.Item.<init>]
Entering [usingLog4jToolkit.Item.<init>]
Entering [usingLog4jToolkit.Inventory.addItem]
Entering [usingLog4jToolkit.Inventory.addItem]
Entering [usingLog4jToolkit.Inventory.addItem]
Entering [usingLog4jToolkit.ShoppingCart.<init>]
Entering [usingLog4jToolkit.ShoppingCartOperator.addShoppingCartItem]
Entering [usingLog4jToolkit.Inventory.removeItem]
Entering [usingLog4jToolkit.ShoppingCart.addItem]
Entering [usingLog4jToolkit.ShoppingCartOperator.addShoppingCartItem]
Entering [usingLog4jToolkit.Inventory.removeItem]
Entering [usingLog4jToolkit.ShoppingCart.addItem]


But if I add this line :
log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n
to the log4j.properties file.
log4j.properties is :

log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n

The output is not what I am looking for :

usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Test.main]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.<init>]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Item.<init>]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Item.<init>]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Item.<init>]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.addItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.addItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.addItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.ShoppingCart.<init>]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.ShoppingCartOperator.addShoppingCartItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.removeItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.ShoppingCart.addItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.ShoppingCartOperator.addShoppingCartItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.Inventory.removeItem]
usingLog4jToolkit.TraceAspectV3.ajc$before$usingLog4jToolkit _TraceAspectV3$1$b314f86e(TraceAspectV3.aj:20)
Entering [usingLog4jToolkit.ShoppingCart.addItem]

Where my mistake.

Regards,
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #73711 is a reply to message #73693] Thu, 02 April 2009 05:37 Go to previous messageGo to next message
Eclipse User
Originally posted by: andrew.eisenberg.springsource.com

I am not sure what this line means (not overly being familiar with Log4J),
but it looks like it prints out the method name and line number of the
logged site.

> log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n

The odd method names you are seeing are aspectj generated methods.

What were you expecting to see?
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #73728 is a reply to message #73711] Thu, 02 April 2009 09:20 Go to previous messageGo to next message
Pierre8r is currently offline Pierre8r
Messages: 10
Registered: July 2009
Junior Member
Hello Andrew,

>>What were you expecting to see?
I try to use AspectJ to trace Java code source.
What I am expecting to do, is to do Jump-to-code aware, the trace
generated by AspectJ into the Eclipse console.

With Log4J if you do :

package usingLog4jToolkit;

import org.apache.log4j.Logger;

//Listing 5.5 A test class

public class Test {
final static Logger log = Logger.getLogger("test");
public static void main(String[] args) {

log.info("Start Program");
etc

With this log4j.properties :
log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n

You have this outout into the Eclipse console windows :

usingLog4jToolkit.Test.main(Test.java:11)
Start Program

And if you click to (Test.java:11), you jump into the Java code :
log.info("Start Program");

What I try to do is the same thing with AspectJ

Regards,

Pierre8r
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #73743 is a reply to message #73728] Thu, 02 April 2009 16:20 Go to previous message
Eclipse User
Originally posted by: andrew.eisenberg.springsource.com

> I try to use AspectJ to trace Java code source.
> What I am expecting to do, is to do Jump-to-code aware, the trace
> generated by AspectJ into the Eclipse console.

The output generated seems correct to me. It seems that you are wondering
why you can't use Eclipse's hyperlink capabilities to jump to the
declaration. This likely hasn't been implemented in AJDT. Does this work
when you remove the AJ nature from the project?

Please raise a bug for this in bugzilla. Also, please include any extra
plugins that you have installed. I am not exactly sure how the hyperlinking
for Log4J is implemented, but the functionality may come from another
plugin. And lastly, include the version of Eclipse you are using (are you
using RAD, STS, 3.3, 3.4, etc?).
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #599856 is a reply to message #73693] Thu, 02 April 2009 05:37 Go to previous message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 77
Registered: July 2009
Member
I am not sure what this line means (not overly being familiar with Log4J),
but it looks like it prints out the method name and line number of the
logged site.

> log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n

The odd method names you are seeing are aspectj generated methods.

What were you expecting to see?
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #599860 is a reply to message #73711] Thu, 02 April 2009 09:20 Go to previous message
Pierre8r is currently offline Pierre8r
Messages: 10
Registered: July 2009
Junior Member
Hello Andrew,

>>What were you expecting to see?
I try to use AspectJ to trace Java code source.
What I am expecting to do, is to do Jump-to-code aware, the trace
generated by AspectJ into the Eclipse console.

With Log4J if you do :

package usingLog4jToolkit;

import org.apache.log4j.Logger;

//Listing 5.5 A test class

public class Test {
final static Logger log = Logger.getLogger("test");
public static void main(String[] args) {

log.info("Start Program");
etc

With this log4j.properties :
log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n

You have this outout into the Eclipse console windows :

usingLog4jToolkit.Test.main(Test.java:11)
Start Program

And if you click to (Test.java:11), you jump into the Java code :
log.info("Start Program");

What I try to do is the same thing with AspectJ

Regards,

Pierre8r
Re: AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n [message #599867 is a reply to message #73728] Thu, 02 April 2009 16:20 Go to previous message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 77
Registered: July 2009
Member
> I try to use AspectJ to trace Java code source.
> What I am expecting to do, is to do Jump-to-code aware, the trace
> generated by AspectJ into the Eclipse console.

The output generated seems correct to me. It seems that you are wondering
why you can't use Eclipse's hyperlink capabilities to jump to the
declaration. This likely hasn't been implemented in AJDT. Does this work
when you remove the AJ nature from the project?

Please raise a bug for this in bugzilla. Also, please include any extra
plugins that you have installed. I am not exactly sure how the hyperlinking
for Log4J is implemented, but the functionality may come from another
plugin. And lastly, include the version of Eclipse you are using (are you
using RAD, STS, 3.3, 3.4, etc?).
Previous Topic:AspectJ Log4J and log4j.appender.dest1.layout.ConversionPattern= %l%n%m%n
Next Topic:eclipse-maven-plugin 2.6 and AJDT
Goto Forum:
  


Current Time: Mon Oct 20 08:08:26 GMT 2014

Powered by FUDForum. Page generated in 0.01920 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software