public void visit() {
Object logger = Instruments.getField(getTarget(), "logger");
if (logger != null) {
if ("org.apache.log4j.Logger".equals(logger.getClass().getName())) {
while (logger != null) {
Log4JLoggerAccessor accessor = new Log4JLoggerAccessor();
accessor.setTarget(logger);
accessor.setApplication(getApplication());
accessor.setContext(true);
visit(accessor);
logger = invokeMethod(logger, "getParent", null, null);
}
} else if ("java.util.logging.Logger".equals(logger.getClass().getName())) {
while (logger != null) {
Jdk14LoggerAccessor accessor = new Jdk14LoggerAccessor();
accessor.setTarget(logger);
accessor.setApplication(getApplication());
accessor.setContext(true);
visit(accessor);
logger = invokeMethod(logger, "getParent", null, null);
}
}
}