You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "SgtOmer (via GitHub)" <gi...@apache.org> on 2025/09/01 22:24:45 UTC
[I] Logger.getName() cause exception [logging-log4j-transform]
SgtOmer opened a new issue, #220:
URL: https://github.com/apache/logging-log4j-transform/issues/220
When trying to convert the following sample class:
```
public class Main {
private static final Logger logger = LogManager.getLogger();
static public void main(String[] args) {
logger.debug(logger.getName());
}
}
```
A ConversionException is thrown:
`org.apache.logging.log4j.weaver.ConversionException: Unsupported method 'org.apache.logging.log4j.Logger#getName'.`
Based on the stack trace a located the bug to be in the `LoggerConversionHandler` in the `handleMethodInstruction` method.
It seems the default operation to an unplanned function is to throw exception instead of keeping the call as is. There is already a section in the switch for this kind of calls, so creating the NOP as the default will also remove a bit of bloat and support more functions. My suggestion is simple:
```
default:
// These are NOPs
mv.invokeInterface(LOGGER_TYPE, new Method(name, descriptor));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org