Skip to content
Discussion options

You must be logged in to vote

Something like this should work for you:

import java

predicate isLoggerCall(MethodAccess ma) {
  ma.getReceiverType().getQualifiedName() = "org.slf4j.Logger" and
  (ma.getMethod().getName() = "info" or ma.getMethod().getName() = "warn" or ...)
}

from MethodAccess ma
where isLoggerCall(ma)
select ma.getArgument(0)

The codeql java extractor hooks into the java compiler and has access to constants before they are inlined. So, you will see actual source code in the results.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sbilello
Comment options

Answer selected by sbilello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants