I am using spring aop to do logging for my application : I have before after and afterthrowing advice configured but the line numbers that I see is not of the target class b
I think this is not specifically a Spring AOP problem but just the way Log4j works, see Javadoc for PatternLayout:
L
Used to output the line number from where the logging request was issued.
WARNING Generating caller location information is extremely slow and should be avoided unless execution speed is not an issue.
So my recommendation is to use a pattern layout without line number and use Spring AOP's capability of determining line numbers, roughly like this:
joinPoint.getSourceLocation().getLine()