[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Parameter construction pointcut?


We have a lot of debug statements in our code base like this:

logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i]));

i.e. the parameters are constructed even when there's no output to the

So, in order to improve the performance without fixing the code I was
thinking about creating an aspect that would enforce the call to the
logger.isDebugEnabled() before any logger.debug() statement.

But it seems the AspectJ can't help me in this case. The fact is you
can't set an advice around logger.debug() to avoid the String.valueOf()
and string concats anyways because those are called before
logger.debug() anyways.

Please, confirm my assumptions or suggest me any solutions besides
fixing the code itself.

P.S. I understand that AspectJ operates on the bytecode but not on the
source code. But is it theoretically possible to augment the AspectJ
with a parameter construction pointcut? Just curious.