diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/AndroidAnnotationProcessor.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/AndroidAnnotationProcessor.java index fa39694b8f..cf0a91b80d 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/AndroidAnnotationProcessor.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/AndroidAnnotationProcessor.java @@ -91,7 +91,7 @@ public synchronized void init(ProcessingEnvironment processingEnv) { plugins.add(0, corePlugin); androidAnnotationsEnv.setPlugins(plugins); } catch (Exception e) { - LOGGER.error("Can't load plugins", e); + LOGGER.error(e, "Can't load plugins"); } } @@ -246,7 +246,7 @@ private void handleException(Set annotations, RoundEnviro Iterator iterator = annotations.iterator(); if (iterator.hasNext()) { Element element = roundEnv.getElementsAnnotatedWith(iterator.next()).iterator().next(); - LOGGER.error("Something went wrong: {}", element, errorMessage); + LOGGER.error(element, "Something went wrong: {}", errorMessage); } else { LOGGER.error("Something went wrong: {}", errorMessage); } diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/generation/SourceCodeWriter.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/generation/SourceCodeWriter.java index ec71ed6e8e..09e81fe74b 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/generation/SourceCodeWriter.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/generation/SourceCodeWriter.java @@ -70,7 +70,7 @@ public OutputStream openBinary(JPackage pkg, String fileName) throws IOException return sourceFile.openOutputStream(); } catch (FilerException e) { - LOGGER.error("Could not generate source file for {}", qualifiedClassName, e.getMessage()); + LOGGER.error("Could not generate source file for {} due to error: {}", qualifiedClassName, e.getMessage()); /* * This exception is expected, when some files are created twice. We * cannot delete existing files, unless using a dirty hack. Files a diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelProcessor.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelProcessor.java index 6c32c6af14..c6a26c0479 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelProcessor.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelProcessor.java @@ -197,7 +197,7 @@ private boolean generateElements(AnnotationElements validatedModel, ProcessHolde if (validatedElements.contains(enclosingElement)) { isElementRemaining = true; } else { - LOGGER.error("Enclosing element {} has not been successfully validated", annotatedElement, enclosingElement); + LOGGER.error(annotatedElement, "Enclosing element {} has not been successfully validated", enclosingElement); } } else { GeneratedClassHolder generatedClassHolder = generatingAnnotationHandler.createGeneratedClassHolder(environment, typeElement); diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelValidator.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelValidator.java index 30b9ecbda3..43c2ccfd9e 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelValidator.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/process/ModelValidator.java @@ -71,17 +71,17 @@ public AnnotationElements validate(AnnotationElements extractedModel, Annotation AnnotationMirror annotationMirror = elementValidation.getAnnotationMirror(); for (ElementValidation.Error error : elementValidation.getErrors()) { - LOGGER.error(error.getMessage(), error.getElement(), annotationMirror); + LOGGER.error(error.getElement(), annotationMirror, error.getMessage()); } for (String warning : elementValidation.getWarnings()) { - LOGGER.warn(warning, elementValidation.getElement(), annotationMirror); + LOGGER.warn(elementValidation.getElement(), annotationMirror, warning); } if (elementValidation.isValid()) { validatedAnnotatedElements.add(annotatedElement); } else { - LOGGER.warn("Element {} invalidated by {}", annotatedElement, annotatedElement, validatorSimpleName); + LOGGER.warn(annotatedElement, "Element {} invalidated by {}", annotatedElement, validatorSimpleName); } } } diff --git a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/logger/Logger.java b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/logger/Logger.java index 6d4cde0ccb..9cbd039d57 100644 --- a/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/logger/Logger.java +++ b/AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/logger/Logger.java @@ -1,5 +1,6 @@ /** * Copyright (C) 2010-2016 eBusiness Information, Excilys Group + * Copyright (C) 2016-2018 the AndroidAnnotations project * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -29,66 +30,46 @@ public Logger(LoggerContext loggerContext, String name) { } public void trace(String message, Object... args) { - trace(message, null, args); - } - - public void trace(String message, Element element, Object... args) { - log(Level.TRACE, message, element, null, null, args); + log(Level.TRACE, message, null, null, null, args); } public void debug(String message, Object... args) { - debug(message, null, args); - } - - public void debug(String message, Element element, Object... args) { - log(Level.DEBUG, message, element, null, null, args); + log(Level.DEBUG, message, null, null, null, args); } public void info(String message, Object... args) { - info(message, null, args); - } - - public void info(String message, Element element, Object... args) { - log(Level.INFO, message, element, null, null, args); + log(Level.INFO, message, null, null, null, args); } public void warn(String message, Object... args) { - warn(message, null, null, args); - } - - public void warn(String message, Throwable thr, Object... args) { - warn(message, null, thr, args); - } - - public void warn(String message, Element element, Object... args) { - warn(message, element, null, args); + warn(null, message, args); } - public void warn(String message, Element element, Throwable thr, Object... args) { - log(Level.WARN, message, element, null, thr, args); + public void warn(Element element, String message, Object... args) { + log(Level.WARN, message, element, null, null, args); } - public void warn(String message, Element element, AnnotationMirror annotationMirror) { + public void warn(Element element, AnnotationMirror annotationMirror, String message) { log(Level.WARN, message, element, annotationMirror, null); } public void error(String message, Object... args) { - error(message, null, null, args); + error(null, null, message, args); } - public void error(String message, Element element, Object... args) { - error(message, element, null, args); + public void error(Element element, String message, Object... args) { + error(element, null, message, args); } - public void error(String message, Throwable thr, Object... args) { - error(message, null, thr, args); + public void error(Throwable thr, String message, Object... args) { + error(null, thr, message, args); } - public void error(String message, Element element, Throwable thr, Object... args) { + public void error(Element element, Throwable thr, String message, Object... args) { log(Level.ERROR, message, element, null, thr, args); } - public void error(String message, Element element, AnnotationMirror annotationMirror) { + public void error(Element element, AnnotationMirror annotationMirror, String message) { log(Level.ERROR, message, element, annotationMirror, null); } @@ -96,7 +77,7 @@ public boolean isLoggable(Level level) { return level.isGreaterOrEquals(loggerContext.getCurrentLevel()); } - public void log(Level level, String message, Element element, AnnotationMirror annotationMirror, Throwable thr, Object... args) { + private void log(Level level, String message, Element element, AnnotationMirror annotationMirror, Throwable thr, Object... args) { if (!isLoggable(level)) { return; }