void (Exception e, String key) { try { Class<? extends ModelsHolder> aClass = getClass(); Class<?> loggerClazz = aClass.getClassLoader().loadClass("com.intellij.openapi.diagnostic.Logger"); Method getInstanceMethod = loggerClazz.getMethod("getInstance", Class.class); Object logger = getInstanceMethod.invoke(null, aClass); Method errorMethod = loggerClazz.getMethod("error", String.class, Throwable.class); errorMethod.invoke(logger, "Failed to parse model with key [" + key + "]", e); } catch (Exception ignore) { } }