diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 00000000000000..d820426cb4d410 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,13 @@ + + + + org.srcdeps.mvn + srcdeps-maven-local-repository + 4.0.0 + + + org.srcdeps.mvn + srcdeps-maven-enforcer + 4.0.0 + + diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 9eea86753c94cf..b6becb13899ea5 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -17,7 +17,7 @@ 1.68 1.0.2 1.0.11 - 2.2.3.Final + 2.2.4.Final-SNAPSHOT 4.5.8.SP1 0.31.0 0.4.1 @@ -3868,6 +3868,11 @@ asm-analysis ${asm.version} + + org.ow2.asm + asm-commons + ${asm.version} + org.slf4j slf4j-api diff --git a/core/deployment/pom.xml b/core/deployment/pom.xml index 8a4d6727b29475..4b90e2006f13ac 100644 --- a/core/deployment/pom.xml +++ b/core/deployment/pom.xml @@ -30,6 +30,10 @@ org.ow2.asm asm + + org.ow2.asm + asm-commons + io.quarkus quarkus-development-mode-spi diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java index 2e990f881b3733..210e47a980f6d5 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java @@ -32,6 +32,8 @@ public final class BytecodeTransformerBuildItem extends MultiBuildItem { final boolean cacheable; + final int classReaderOptions; + public BytecodeTransformerBuildItem(String classToTransform, BiFunction visitorFunction) { this(classToTransform, visitorFunction, null); @@ -49,22 +51,23 @@ public BytecodeTransformerBuildItem(boolean eager, String classToTransform, public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction visitorFunction, boolean cacheable) { - this(eager, classToTransform, visitorFunction, null, cacheable); + this(eager, classToTransform, visitorFunction, null, cacheable, 0); } public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction visitorFunction, Set requireConstPoolEntry) { - this(eager, classToTransform, visitorFunction, requireConstPoolEntry, false); + this(eager, classToTransform, visitorFunction, requireConstPoolEntry, false, 0); } public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction visitorFunction, Set requireConstPoolEntry, - boolean cacheable) { + boolean cacheable, int classReaderOptions) { this.eager = eager; this.classToTransform = classToTransform; this.visitorFunction = visitorFunction; this.requireConstPoolEntry = requireConstPoolEntry; this.cacheable = cacheable; + this.classReaderOptions = classReaderOptions; } public String getClassToTransform() { @@ -86,4 +89,8 @@ public boolean isEager() { public boolean isCacheable() { return cacheable; } + + public int getClassReaderOptions() { + return classReaderOptions; + } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/IndexWrapper.java b/core/deployment/src/main/java/io/quarkus/deployment/index/IndexWrapper.java index 05a7ca734d7bb6..33cb62d5fc2b98 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/index/IndexWrapper.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/index/IndexWrapper.java @@ -139,6 +139,12 @@ public Collection getAnnotationsWithRepeatable(DotName annot return this.index.getAnnotationsWithRepeatable(annotationName, index); } + @Override + public Collection getKnownUsers(DotName className) { + // TODO additionalClasses? + return index.getKnownUsers(className); + } + private void getAllKnownSubClasses(DotName className, Set allKnown, Set processedClasses) { final Set subClassesToProcess = new HashSet(); subClassesToProcess.add(className); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java new file mode 100644 index 00000000000000..289fbc748e2156 --- /dev/null +++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java @@ -0,0 +1,182 @@ +package io.quarkus.deployment.logging; + +import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.DotName; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Type; +import org.objectweb.asm.commons.LocalVariablesSorter; + +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; +import io.quarkus.gizmo.Gizmo; + +public class LoggingWithPanacheProcessor { + private static final DotName QUARKUS_LOG_DOTNAME = DotName.createSimple("io.quarkus.runtime.logging.Log"); + + private static final String QUARKUS_LOG_BINARY_NAME = "io/quarkus/runtime/logging/Log"; + + private static final String SYNTHETIC_LOGGER_FIELD_NAME = "quarkusSyntheticLogger"; + + private static final String JBOSS_LOGGER_BINARY_NAME = "org/jboss/logging/Logger"; + private static final String JBOSS_LOGGER_DESCRIPTOR = "L" + JBOSS_LOGGER_BINARY_NAME + ";"; + private static final String GET_LOGGER_DESCRIPTOR = "(Ljava/lang/String;)" + JBOSS_LOGGER_DESCRIPTOR; + + @BuildStep + public void process(CombinedIndexBuildItem index, BuildProducer transformers) { + for (ClassInfo clazz : index.getIndex().getKnownUsers(QUARKUS_LOG_DOTNAME)) { + String className = clazz.name().toString(); + + transformers.produce(new BytecodeTransformerBuildItem(false, className, (ignored, visitor) -> { + return new AddLoggerFieldAndRewriteInvocations(visitor, className); + }, null, false, ClassReader.EXPAND_FRAMES)); + } + } + + /** + * Makes the following modifications to the visited class: + *
    + *
  • adds a {@code private static final} field of type {@code org.jboss.logging.Logger};
  • + *
  • initializes the field (to {@code Logger.getLogger(className)}) at the beginning of the + * static initializer (creating one if missing);
  • + *
  • rewrites all invocations of {@code static} methods on {@code io.quarkus.runtime.logging.Log} + * to corresponding invocations of virtual methods on the logger field.
  • + *
+ * Assumes that the set of {@code static} methods on {@code io.quarkus.runtime.logging.Log} + * is identical (when it comes to names, return types and parameter types) to the set of virtual methods + * on {@code org.jboss.logging.BasicLogger}. + */ + private static class AddLoggerFieldAndRewriteInvocations extends ClassVisitor { + private final String className; + private final String classNameBinary; + + private boolean generatedLoggerFieldInitialization; + + public AddLoggerFieldAndRewriteInvocations(ClassVisitor visitor, String className) { + super(Gizmo.ASM_API_VERSION, visitor); + this.className = className; + this.classNameBinary = className.replace(".", "/"); + } + + @Override + public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { + super.visit(version, access, name, signature, superName, interfaces); + + // TODO per ClassVisitor javadoc, this should probably be called a bit later? + super.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL, + SYNTHETIC_LOGGER_FIELD_NAME, JBOSS_LOGGER_DESCRIPTOR, null, null); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { + MethodVisitor visitor = super.visitMethod(access, name, descriptor, signature, exceptions); + if (visitor == null) { + return null; + } + + return new LocalVariablesSorter(Gizmo.ASM_API_VERSION, access, descriptor, visitor) { + @Override + public void visitCode() { + if ("".equals(name)) { + super.visitLdcInsn(className); + super.visitMethodInsn(Opcodes.INVOKESTATIC, JBOSS_LOGGER_BINARY_NAME, "getLogger", + GET_LOGGER_DESCRIPTOR, false); + super.visitFieldInsn(Opcodes.PUTSTATIC, classNameBinary, SYNTHETIC_LOGGER_FIELD_NAME, + JBOSS_LOGGER_DESCRIPTOR); + generatedLoggerFieldInitialization = true; + } + + super.visitCode(); + } + + @Override + public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) { + if (!QUARKUS_LOG_BINARY_NAME.equals(owner)) { + super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); + return; + } + + Type[] argTypes = Type.getArgumentTypes(descriptor); + int numArgs = argTypes.length; + int[] locals = null; + + boolean directStackManipulation = isDirectStackManipulationPossible(argTypes); + + // for 0, 1 or 2 arguments of the logger method, where each only takes 1 stack slot, + // direct stack manipulation is possible + // for 3 or more arguments, or less arguments but at least one taking 2 stack slots, + // we move them from stack to local variables and restore later + if (!directStackManipulation) { + // stack: [arg1 arg2 arg3 arg4] locals: {} + // stack: [arg1 arg2 arg3] locals: {l1 = arg4} + // stack: [arg1 arg2] locals: {l1 = arg4 l2 = arg3} + // stack: [arg1] locals: {l1 = arg4 l2 = arg3 l3 = arg2} + // stack: [] locals: {l1 = arg4 l2 = arg3 l3 = arg2 l4 = arg1} + locals = new int[numArgs]; + for (int i = numArgs - 1; i >= 0; i--) { + locals[i] = newLocal(argTypes[i]); + super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ISTORE), locals[i]); + } + } + + // stack: [] -> [logger] + super.visitFieldInsn(Opcodes.GETSTATIC, classNameBinary, SYNTHETIC_LOGGER_FIELD_NAME, + JBOSS_LOGGER_DESCRIPTOR); + + if (directStackManipulation) { + if (numArgs == 1) { + // stack: [arg1 logger] -> [logger arg1] + super.visitInsn(Opcodes.SWAP); + } else if (numArgs == 2) { + // stack: [arg1 arg2 logger] -> [logger arg1 arg2 logger] + super.visitInsn(Opcodes.DUP_X2); + // stack: [logger arg1 arg2 logger] -> [logger arg1 arg2] + super.visitInsn(Opcodes.POP); + } + } else { + // stack: [logger] locals: {l1 = arg4 l2 = arg3 l3 = arg2 l4 = arg1} + // stack: [logger arg1] locals: {l1 = arg4 l2 = arg3 l3 = arg2} + // stack: [logger arg1 arg2] locals: {l1 = arg4 l2 = arg3} + // stack: [logger arg1 arg2 arg3] locals: {l1 = arg4} + // stack: [logger arg1 arg2 arg3 arg4] locals: {} + for (int i = 0; i < numArgs; i++) { + super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ILOAD), locals[i]); + } + } + + super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, JBOSS_LOGGER_BINARY_NAME, name, descriptor, false); + } + + private boolean isDirectStackManipulationPossible(Type[] argTypes) { + return argTypes.length == 0 + || argTypes.length == 1 && argTypes[0].getSize() == 1 + || argTypes.length == 2 && argTypes[0].getSize() == 1 && argTypes[1].getSize() == 1; + } + }; + } + + @Override + public void visitEnd() { + if (!generatedLoggerFieldInitialization) { + MethodVisitor visitor = super.visitMethod(Opcodes.ACC_STATIC, "", "()V", null, null); + visitor.visitCode(); + visitor.visitLdcInsn(className); + visitor.visitMethodInsn(Opcodes.INVOKESTATIC, JBOSS_LOGGER_BINARY_NAME, "getLogger", + GET_LOGGER_DESCRIPTOR, false); + visitor.visitFieldInsn(Opcodes.PUTSTATIC, classNameBinary, SYNTHETIC_LOGGER_FIELD_NAME, + JBOSS_LOGGER_DESCRIPTOR); + visitor.visitInsn(Opcodes.RETURN); + visitor.visitMaxs(1, 0); + visitor.visitEnd(); + + generatedLoggerFieldInitialization = true; + } + + super.visitEnd(); + } + } +} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java index bd49e9f1e0f987..cc6f3d74727b1e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java @@ -60,6 +60,7 @@ TransformedClassesBuildItem handleClassTransformation(List> constScanning = new HashMap<>(); Set eager = new HashSet<>(); Set nonCacheable = new HashSet<>(); + Map classReaderOptions = new HashMap<>(); for (BytecodeTransformerBuildItem i : bytecodeTransformerBuildItems) { bytecodeTransformers.computeIfAbsent(i.getClassToTransform(), (h) -> new ArrayList<>()) .add(i.getVisitorFunction()); @@ -75,6 +76,7 @@ TransformedClassesBuildItem handleClassTransformation(List transformedToArchive = new ConcurrentHashMap<>(); @@ -132,7 +134,8 @@ public TransformedClassesBuildItem.TransformedClass call() throws Exception { for (BiFunction i : visitors) { visitor = i.apply(className, visitor); } - cr.accept(visitor, 0); + int parsingOptions = classReaderOptions.getOrDefault(className, 0); + cr.accept(visitor, parsingOptions); byte[] data = writer.toByteArray(); if (BootstrapDebug.DEBUG_TRANSFORMED_CLASSES_DIR != null) { File debugPath = new File(BootstrapDebug.DEBUG_TRANSFORMED_CLASSES_DIR); diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/Log.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/Log.java new file mode 100644 index 00000000000000..31e710ecf859d0 --- /dev/null +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/Log.java @@ -0,0 +1,2310 @@ +package io.quarkus.runtime.logging; + +import org.jboss.logging.Logger; + +/** + * Copy of {@link org.jboss.logging.BasicLogger}. + * Invocations of all {@code static} methods of this class are, during build time, replaced by invocations + * of the same methods on a generated instance of {@link Logger}. + */ +// this can be regenerated from BasicLogger source code using a small set of mechanical transformations, if need be +public final class Log { + /** + * Check to see if the given level is enabled for this logger. + * + * @param level the level to check for + * @return {@code true} if messages may be logged at the given level, {@code false} otherwise + */ + public static boolean isEnabled(Logger.Level level) { + throw fail(); + } + + /** + * Check to see if the {@code TRACE} level is enabled for this logger. + * + * @return {@code true} if messages logged at {@link org.jboss.logging.Logger.Level#TRACE} may be accepted, {@code false} + * otherwise + */ + public static boolean isTraceEnabled() { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE. + * + * @param message the message + */ + public static void trace(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of TRACE. + * + * @param message the message + * @param t the throwable + */ + public static void trace(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of TRACE and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void trace(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of TRACE. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void trace(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void tracev(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void tracev(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void tracev(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void tracev(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void tracev(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void tracev(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void tracev(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void tracev(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void tracef(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void tracef(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void tracef(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void tracef(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void tracef(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void tracef(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void tracef(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void tracef(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void tracef(String format, int arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(String format, int arg1, int arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(String format, int arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, int arg1, int arg2, int arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, int arg1, int arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, int arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void tracef(Throwable t, String format, int arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(Throwable t, String format, int arg1, int arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(Throwable t, String format, int arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, int arg1, int arg2, int arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, int arg1, int arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, int arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void tracef(String format, long arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(String format, long arg1, long arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(String format, long arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, long arg1, long arg2, long arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, long arg1, long arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(String format, long arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void tracef(Throwable t, String format, long arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(Throwable t, String format, long arg1, long arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void tracef(Throwable t, String format, long arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, long arg1, long arg2, long arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, long arg1, long arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of TRACE. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void tracef(Throwable t, String format, long arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Check to see if the {@code DEBUG} level is enabled for this logger. + * + * @return {@code true} if messages logged at {@link org.jboss.logging.Logger.Level#DEBUG} may be accepted, {@code false} + * otherwise + */ + public static boolean isDebugEnabled() { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG. + * + * @param message the message + */ + public static void debug(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of DEBUG. + * + * @param message the message + * @param t the throwable + */ + public static void debug(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of DEBUG and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void debug(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of DEBUG. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void debug(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void debugv(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void debugv(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void debugv(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void debugv(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void debugv(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void debugv(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void debugv(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void debugv(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void debugf(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void debugf(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void debugf(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void debugf(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void debugf(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void debugf(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void debugf(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void debugf(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void debugf(String format, int arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(String format, int arg1, int arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(String format, int arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, int arg1, int arg2, int arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, int arg1, int arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, int arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void debugf(Throwable t, String format, int arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(Throwable t, String format, int arg1, int arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(Throwable t, String format, int arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, int arg1, int arg2, int arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, int arg1, int arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, int arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void debugf(String format, long arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(String format, long arg1, long arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(String format, long arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, long arg1, long arg2, long arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, long arg1, long arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(String format, long arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg the parameter + */ + public static void debugf(Throwable t, String format, long arg) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(Throwable t, String format, long arg1, long arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + */ + public static void debugf(Throwable t, String format, long arg1, Object arg2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, long arg1, long arg2, long arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, long arg1, long arg2, Object arg3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of DEBUG. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param arg1 the first parameter + * @param arg2 the second parameter + * @param arg3 the third parameter + */ + public static void debugf(Throwable t, String format, long arg1, Object arg2, Object arg3) { + throw fail(); + } + + /** + * Check to see if the {@code INFO} level is enabled for this logger. + * + * @return {@code true} if messages logged at {@link org.jboss.logging.Logger.Level#INFO} may be accepted, {@code false} + * otherwise + */ + public static boolean isInfoEnabled() { + throw fail(); + } + + /** + * Issue a log message with a level of INFO. + * + * @param message the message + */ + public static void info(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of INFO. + * + * @param message the message + * @param t the throwable + */ + public static void info(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of INFO and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void info(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of INFO. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void info(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void infov(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void infov(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void infov(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void infov(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void infov(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void infov(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void infov(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void infov(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void infof(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void infof(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void infof(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void infof(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void infof(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void infof(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void infof(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of INFO. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void infof(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN. + * + * @param message the message + */ + public static void warn(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of WARN. + * + * @param message the message + * @param t the throwable + */ + public static void warn(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of WARN and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void warn(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of WARN. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void warn(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void warnv(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void warnv(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void warnv(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void warnv(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void warnv(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void warnv(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void warnv(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void warnv(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void warnf(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void warnf(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void warnf(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void warnf(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void warnf(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void warnf(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void warnf(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of WARN. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void warnf(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR. + * + * @param message the message + */ + public static void error(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of ERROR. + * + * @param message the message + * @param t the throwable + */ + public static void error(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of ERROR and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void error(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of ERROR. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void error(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void errorv(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void errorv(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void errorv(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void errorv(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void errorv(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void errorv(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void errorv(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void errorv(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void errorf(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void errorf(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void errorf(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void errorf(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void errorf(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void errorf(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void errorf(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of ERROR. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void errorf(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL. + * + * @param message the message + */ + public static void fatal(Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of FATAL. + * + * @param message the message + * @param t the throwable + */ + public static void fatal(Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable with a level of FATAL and a specific logger class name. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void fatal(String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable with a level of FATAL. + * + * @param loggerFqcn the logger class name + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void fatal(String loggerFqcn, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param params the parameters + */ + public static void fatalv(String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the sole parameter + */ + public static void fatalv(String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void fatalv(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void fatalv(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void fatalv(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void fatalv(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void fatalv(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting. + * + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void fatalv(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void fatalf(String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void fatalf(String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void fatalf(String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void fatalf(String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void fatalf(Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void fatalf(Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void fatalf(Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message with a level of FATAL. + * + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void fatalf(Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Log a message at the given level. + * + * @param level the level + * @param message the message + */ + public static void log(Logger.Level level, Object message) { + throw fail(); + } + + /** + * Issue a log message and throwable at the given log level. + * + * @param level the level + * @param message the message + * @param t the throwable + */ + public static void log(Logger.Level level, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message and throwable at the given log level and a specific logger class name. + * + * @param level the level + * @param loggerFqcn the logger class name + * @param message the message + * @param t the throwable + */ + public static void log(Logger.Level level, String loggerFqcn, Object message, Throwable t) { + throw fail(); + } + + /** + * Issue a log message with parameters and a throwable at the given log level. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param message the message + * @param params the message parameters + * @param t the throwable + */ + public static void log(String loggerFqcn, Logger.Level level, Object message, Object[] params, Throwable t) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param format the message format string + * @param params the parameters + */ + public static void logv(Logger.Level level, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param format the message format string + * @param param1 the sole parameter + */ + public static void logv(Logger.Level level, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logv(Logger.Level level, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logv(Logger.Level level, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void logv(Logger.Level level, Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void logv(Logger.Level level, Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logv(Logger.Level level, Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logv(Logger.Level level, Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable + * @param format the message format string + * @param params the parameters + */ + public static void logv(String loggerFqcn, Logger.Level level, Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the sole parameter + */ + public static void logv(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logv(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable + * @param format the message format string + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logv(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1, Object param2, + Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the parameters + */ + public static void logf(Logger.Level level, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void logf(Logger.Level level, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logf(Logger.Level level, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logf(Logger.Level level, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param params the parameters + */ + public static void logf(Logger.Level level, Throwable t, String format, Object... params) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the sole parameter + */ + public static void logf(Logger.Level level, Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logf(Logger.Level level, Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Issue a formatted log message at the given log level. + * + * @param level the level + * @param t the throwable + * @param format the format string, as per {@link String#format(String, Object...)} + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logf(Logger.Level level, Throwable t, String format, Object param1, Object param2, Object param3) { + throw fail(); + } + + /** + * Log a message at the given level. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable cause + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the sole parameter + */ + public static void logf(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1) { + throw fail(); + } + + /** + * Log a message at the given level. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable cause + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + */ + public static void logf(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1, Object param2) { + throw fail(); + } + + /** + * Log a message at the given level. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable cause + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param param1 the first parameter + * @param param2 the second parameter + * @param param3 the third parameter + */ + public static void logf(String loggerFqcn, Logger.Level level, Throwable t, String format, Object param1, Object param2, + Object param3) { + throw fail(); + } + + /** + * Log a message at the given level. + * + * @param loggerFqcn the logger class name + * @param level the level + * @param t the throwable cause + * @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor + * @param params the message parameters + */ + public static void logf(String loggerFqcn, Logger.Level level, Throwable t, String format, Object... params) { + throw fail(); + } + + private static UnsupportedOperationException fail() { + return new UnsupportedOperationException("Using " + Log.class.getName() + + " is only possible with Quarkus bytecode transformation"); + } +} diff --git a/docs/src/main/asciidoc/logging.adoc b/docs/src/main/asciidoc/logging.adoc index 8c22f8f9353d2b..29435a4aa96609 100644 --- a/docs/src/main/asciidoc/logging.adoc +++ b/docs/src/main/asciidoc/logging.adoc @@ -77,6 +77,29 @@ class SimpleBean { NOTE: The logger instances are cached internally. Therefore, a logger injected e.g. into a `@RequestScoped` bean is shared for all bean instances to avoid possible performance penalty associated with logger instantiation. +=== Logging with Panache + +Instead of declaring or injecting an `org.jboss.logging.Logger`, you can use the simplified logging API: + +[source,java] +---- +import io.quarkus.runtime.logging.Log; // <1> + +class MyService { // <2> + public void doSomething() { + Log.info("Simple!"); // <3> + } +} +---- +<1> The `io.quarkus.runtime.logging.Log` class mirrors the JBoss Logging API, except all methods are `static`. +<2> Note that the class doesn't declare a logger field. + This is because during application build, a `private static final org.jboss.logging.Logger` field is created automatically, in each class that uses the `Log` API. + The fully quallified name of the class that calls the `Log` methods is used as a logger name. +<3> Finally, during application build, all calls to `Log` methods are rewritten to regular JBoss Logging calls on the logger field. + +WARNING: Only use the `Log` API in application classes, not in external dependencies. + `Log` method calls that are not processed by Quarkus at build time will throw an exception. + === What about Apache Log4j ? link:https://logging.apache.org/log4j/2.x/[Log4j] is a logging implementation: it contains a logging backend and a logging facade. diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 94a291ef5bdf78..495d73c60c30a0 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -37,7 +37,7 @@ 2.0.2 1.3.3 - 2.2.3.Final + 2.2.4.Final-SNAPSHOT 5.7.0 3.6.3 3.19.0 diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java index d90f162a2273ee..c8a58607c4498d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java @@ -177,6 +177,12 @@ public Collection getAnnotationsWithRepeatable(DotName annot return this.index.getAnnotationsWithRepeatable(annotationName, index); } + @Override + public Collection getKnownUsers(DotName className) { + // TODO additionalClasses? + return index.getKnownUsers(className); + } + private void getAllKnownSubClasses(DotName className, Set allKnown, Set processedClasses) { final Set subClassesToProcess = new HashSet(); subClassesToProcess.add(className); diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 529730de201a57..09e908792280c4 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -36,7 +36,7 @@ 1.8 2.0.2 - 2.2.3.Final + 2.2.4.Final-SNAPSHOT 5.7.0 3.6.3 3.19.0 diff --git a/integration-tests/logging-panache/pom.xml b/integration-tests/logging-panache/pom.xml new file mode 100644 index 00000000000000..e15484e26d3e57 --- /dev/null +++ b/integration-tests/logging-panache/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + + quarkus-integration-tests-parent + io.quarkus + 999-SNAPSHOT + + + quarkus-integration-test-logging-panache + + Quarkus - Integration Tests - Logging with Panache + + + + io.quarkus + quarkus-arc-deployment + test + + + io.quarkus + quarkus-resteasy + test + + + + io.quarkus + quarkus-junit5-internal + test + + + io.rest-assured + rest-assured + test + + + org.assertj + assertj-core + test + + + + + io.quarkus + quarkus-resteasy-deployment + ${project.version} + pom + test + + + * + * + + + + + diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GenerateAllLogUsages.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GenerateAllLogUsages.java new file mode 100644 index 00000000000000..599c1247a2fe1c --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GenerateAllLogUsages.java @@ -0,0 +1,66 @@ +package io.quarkus.logging; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Parameter; +import java.util.Arrays; +import java.util.Comparator; + +import org.jboss.logging.Logger; + +import io.quarkus.runtime.logging.Log; + +public class GenerateAllLogUsages { + public static void main(String[] args) { + println("package io.quarkus.logging;"); + println(""); + println("import io.quarkus.runtime.logging.Log;"); + println(""); + println("// generated by GenerateAllLogUsages, don't update manually"); + println("public class GeneratedBean {"); + println(" public void testLogging() {"); + Arrays.stream(Log.class.getDeclaredMethods()) + .filter(method -> Modifier.isPublic(method.getModifiers())) + .sorted(Comparator.comparing(Method::getName).thenComparingInt(Method::getParameterCount)) + .forEach(method -> { + Parameter[] parameters = method.getParameters(); + String[] arguments = new String[method.getParameterCount()]; + for (int i = 0; i < parameters.length; i++) { + Parameter parameter = parameters[i]; + String argument; + if (parameter.getType() == Object.class && "message".equals(parameter.getName())) { + argument = "\"foobar\""; + } else if (parameter.getType() == Object.class + && (parameter.getName().startsWith("param") || parameter.getName().startsWith("arg"))) { + argument = "new Object()"; + } else if (parameter.getType() == Object[].class && "params".equals(parameter.getName())) { + argument = "new Object[] {}"; + } else if (parameter.getType() == String.class && "loggerFqcn".equals(parameter.getName())) { + argument = "\"io.quarkus.logging.GeneratedBean\""; + } else if (parameter.getType() == String.class && "format".equals(parameter.getName())) { + argument = "\"foobar\""; + } else if (parameter.getType() == int.class) { + argument = "13"; + } else if (parameter.getType() == long.class) { + argument = "42L"; + } else if (parameter.getType() == Throwable.class) { + argument = "new NoStackTraceTestException()"; + } else if (parameter.getType() == Logger.Level.class) { + argument = "org.jboss.logging.Logger.Level.INFO"; + } else { + throw new RuntimeException("Couldn't generate argument value for parameter " + i + " of type " + + method.getParameterTypes()[i] + ": " + method.toString()); + } + arguments[i] = argument; + } + + println(" Log." + method.getName() + "(" + String.join(", ", arguments) + ");"); + }); + println(" }"); + println("}"); + } + + private static void println(String string) { + System.out.println(string); + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GeneratedBean.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GeneratedBean.java new file mode 100644 index 00000000000000..63ccb17c868ddf --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/GeneratedBean.java @@ -0,0 +1,221 @@ +package io.quarkus.logging; + +import io.quarkus.runtime.logging.Log; + +// generated by GenerateAllLogUsages, don't update manually +public class GeneratedBean { + public void testLogging() { + Log.debug("foobar"); + Log.debug("foobar", new NoStackTraceTestException()); + Log.debug("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.debug("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.debugf("foobar", new Object[] {}); + Log.debugf("foobar", new Object()); + Log.debugf("foobar", 13); + Log.debugf("foobar", 42L); + Log.debugf("foobar", 13, new Object()); + Log.debugf("foobar", 13, 13); + Log.debugf(new NoStackTraceTestException(), "foobar", 13); + Log.debugf(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.debugf("foobar", new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L); + Log.debugf("foobar", 42L, new Object()); + Log.debugf("foobar", 42L, 42L); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L, new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L, 42L); + Log.debugf("foobar", 13, 13, new Object()); + Log.debugf("foobar", 13, 13, 13); + Log.debugf(new NoStackTraceTestException(), "foobar", 13, new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 13, 13); + Log.debugf("foobar", 13, new Object(), new Object()); + Log.debugf("foobar", new Object(), new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.debugf("foobar", 42L, 42L, 42L); + Log.debugf("foobar", 42L, 42L, new Object()); + Log.debugf("foobar", 42L, new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L, 42L, 42L); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L, 42L, new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 42L, new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 13, new Object(), new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 13, 13, new Object()); + Log.debugf(new NoStackTraceTestException(), "foobar", 13, 13, 13); + Log.debugv("foobar", new Object[] {}); + Log.debugv("foobar", new Object()); + Log.debugv(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.debugv("foobar", new Object(), new Object()); + Log.debugv(new NoStackTraceTestException(), "foobar", new Object()); + Log.debugv("foobar", new Object(), new Object(), new Object()); + Log.debugv(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.debugv(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.error("foobar"); + Log.error("foobar", new NoStackTraceTestException()); + Log.error("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.error("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.errorf("foobar", new Object[] {}); + Log.errorf("foobar", new Object()); + Log.errorf("foobar", new Object(), new Object()); + Log.errorf(new NoStackTraceTestException(), "foobar", new Object()); + Log.errorf(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.errorf(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.errorf("foobar", new Object(), new Object(), new Object()); + Log.errorf(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.errorv("foobar", new Object[] {}); + Log.errorv("foobar", new Object()); + Log.errorv(new NoStackTraceTestException(), "foobar", new Object()); + Log.errorv("foobar", new Object(), new Object()); + Log.errorv(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.errorv(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.errorv("foobar", new Object(), new Object(), new Object()); + Log.errorv(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.fatal("foobar"); + Log.fatal("foobar", new NoStackTraceTestException()); + Log.fatal("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.fatal("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.fatalf("foobar", new Object()); + Log.fatalf("foobar", new Object[] {}); + Log.fatalf(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.fatalf(new NoStackTraceTestException(), "foobar", new Object()); + Log.fatalf("foobar", new Object(), new Object()); + Log.fatalf("foobar", new Object(), new Object(), new Object()); + Log.fatalf(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.fatalf(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.fatalv("foobar", new Object[] {}); + Log.fatalv("foobar", new Object()); + Log.fatalv(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.fatalv(new NoStackTraceTestException(), "foobar", new Object()); + Log.fatalv("foobar", new Object(), new Object()); + Log.fatalv(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.fatalv("foobar", new Object(), new Object(), new Object()); + Log.fatalv(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.info("foobar"); + Log.info("foobar", new NoStackTraceTestException()); + Log.info("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.info("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.infof("foobar", new Object[] {}); + Log.infof("foobar", new Object()); + Log.infof(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.infof(new NoStackTraceTestException(), "foobar", new Object()); + Log.infof("foobar", new Object(), new Object()); + Log.infof(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.infof("foobar", new Object(), new Object(), new Object()); + Log.infof(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.infov("foobar", new Object[] {}); + Log.infov("foobar", new Object()); + Log.infov(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.infov(new NoStackTraceTestException(), "foobar", new Object()); + Log.infov("foobar", new Object(), new Object()); + Log.infov("foobar", new Object(), new Object(), new Object()); + Log.infov(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.infov(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.isDebugEnabled(); + Log.isEnabled(org.jboss.logging.Logger.Level.INFO); + Log.isInfoEnabled(); + Log.isTraceEnabled(); + Log.log(org.jboss.logging.Logger.Level.INFO, "foobar"); + Log.log(org.jboss.logging.Logger.Level.INFO, "foobar", new NoStackTraceTestException()); + Log.log(org.jboss.logging.Logger.Level.INFO, "io.quarkus.logging.GeneratedBean", "foobar", + new NoStackTraceTestException()); + Log.log("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, "foobar", new Object[] {}, + new NoStackTraceTestException()); + Log.logf(org.jboss.logging.Logger.Level.INFO, "foobar", new Object()); + Log.logf(org.jboss.logging.Logger.Level.INFO, "foobar", new Object[] {}); + Log.logf(org.jboss.logging.Logger.Level.INFO, "foobar", new Object(), new Object()); + Log.logf(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.logf(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object()); + Log.logf(org.jboss.logging.Logger.Level.INFO, "foobar", new Object(), new Object(), new Object()); + Log.logf("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object()); + Log.logf("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object[] {}); + Log.logf(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.logf("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object(), new Object()); + Log.logf(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object(), new Object(), + new Object()); + Log.logf("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object(), new Object(), new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, "foobar", new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, "foobar", new Object[] {}); + Log.logv(org.jboss.logging.Logger.Level.INFO, "foobar", new Object(), new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.logv(org.jboss.logging.Logger.Level.INFO, "foobar", new Object(), new Object(), new Object()); + Log.logv("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object[] {}); + Log.logv("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.logv(org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), "foobar", new Object(), new Object(), + new Object()); + Log.logv("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object(), new Object()); + Log.logv("io.quarkus.logging.GeneratedBean", org.jboss.logging.Logger.Level.INFO, new NoStackTraceTestException(), + "foobar", new Object(), new Object(), new Object()); + Log.trace("foobar"); + Log.trace("foobar", new NoStackTraceTestException()); + Log.trace("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.trace("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.tracef("foobar", new Object[] {}); + Log.tracef("foobar", new Object()); + Log.tracef("foobar", 13); + Log.tracef("foobar", 42L); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L); + Log.tracef("foobar", new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.tracef(new NoStackTraceTestException(), "foobar", new Object()); + Log.tracef("foobar", 13, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 13); + Log.tracef("foobar", 13, 13); + Log.tracef("foobar", 42L, 42L); + Log.tracef("foobar", 42L, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L, 42L); + Log.tracef("foobar", 42L, new Object(), new Object()); + Log.tracef("foobar", new Object(), new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.tracef("foobar", 13, new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 13, 13); + Log.tracef("foobar", 13, 13, 13); + Log.tracef("foobar", 13, 13, new Object()); + Log.tracef("foobar", 42L, 42L, 42L); + Log.tracef("foobar", 42L, 42L, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 13, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L, 42L, 42L); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L, 42L, new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 42L, new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 13, new Object(), new Object()); + Log.tracef(new NoStackTraceTestException(), "foobar", 13, 13, 13); + Log.tracef(new NoStackTraceTestException(), "foobar", 13, 13, new Object()); + Log.tracev("foobar", new Object()); + Log.tracev("foobar", new Object[] {}); + Log.tracev("foobar", new Object(), new Object()); + Log.tracev(new NoStackTraceTestException(), "foobar", new Object()); + Log.tracev(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.tracev(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.tracev("foobar", new Object(), new Object(), new Object()); + Log.tracev(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.warn("foobar"); + Log.warn("foobar", new NoStackTraceTestException()); + Log.warn("io.quarkus.logging.GeneratedBean", "foobar", new NoStackTraceTestException()); + Log.warn("io.quarkus.logging.GeneratedBean", "foobar", new Object[] {}, new NoStackTraceTestException()); + Log.warnf("foobar", new Object[] {}); + Log.warnf("foobar", new Object()); + Log.warnf(new NoStackTraceTestException(), "foobar", new Object()); + Log.warnf("foobar", new Object(), new Object()); + Log.warnf(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.warnf(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.warnf("foobar", new Object(), new Object(), new Object()); + Log.warnf(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + Log.warnv("foobar", new Object[] {}); + Log.warnv("foobar", new Object()); + Log.warnv("foobar", new Object(), new Object()); + Log.warnv(new NoStackTraceTestException(), "foobar", new Object[] {}); + Log.warnv(new NoStackTraceTestException(), "foobar", new Object()); + Log.warnv(new NoStackTraceTestException(), "foobar", new Object(), new Object()); + Log.warnv("foobar", new Object(), new Object(), new Object()); + Log.warnv(new NoStackTraceTestException(), "foobar", new Object(), new Object(), new Object()); + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java new file mode 100644 index 00000000000000..1e12df64178c5a --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java @@ -0,0 +1,40 @@ +package io.quarkus.logging; + +import javax.annotation.PostConstruct; +import javax.inject.Singleton; + +import io.quarkus.runtime.logging.Log; + +@Singleton +public class LoggingBean { + static { + Log.info("Heya!"); + } + + @PostConstruct + public void setup() { + Log.tracef("%s created", LoggingBean.class.getSimpleName()); + } + + public void doSomething() { + if (Log.isDebugEnabled()) { + Log.debug("starting massive computation"); + } + + Log.debugf("one: %d", 42); + Log.tracef("two: %d | %d", 42, 13); + Log.debugf("three: %d | %d | %d", 42, 13, 1); + + Log.debugv("one: {0}", "foo"); + Log.infov("two: {0} | {1}", "foo", "bar"); + Log.warnv("three: {0} | {1} | {2}", "foo", "bar", "baz"); + Log.errorv("four: {0} | {1} | {2} | {3}", "foo", "bar", "baz", "quux"); + + Exception error = new NoStackTraceTestException(); + + Log.warnv(error, "{0} | {1} | {2} | {3}", "foo", "bar", "baz", "quux"); + + Log.error("Hello Error", error); + } + +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingEndpoint.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingEndpoint.java new file mode 100644 index 00000000000000..33f3fe6922bdb7 --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingEndpoint.java @@ -0,0 +1,15 @@ +package io.quarkus.logging; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +import io.quarkus.runtime.logging.Log; + +@Path("/logging") +public class LoggingEndpoint { + @GET + public String hello() { + Log.info("hello"); + return "hello"; + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheDevModeTest.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheDevModeTest.java new file mode 100644 index 00000000000000..c382c1c259d288 --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheDevModeTest.java @@ -0,0 +1,47 @@ +package io.quarkus.logging; + +import static io.restassured.RestAssured.when; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; +import java.util.logging.Formatter; +import java.util.stream.Collectors; + +import org.jboss.logmanager.formatters.PatternFormatter; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.test.QuarkusDevModeTest; + +public class LoggingWithPanacheDevModeTest { + @RegisterExtension + static final QuarkusDevModeTest TEST = new QuarkusDevModeTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(LoggingEndpoint.class)) + .setLogRecordPredicate(record -> "io.quarkus.logging.LoggingEndpoint".equals(record.getLoggerName())); + + @Test + public void testRepositoryIsReloaded() { + Formatter formatter = new PatternFormatter("[%p] %m"); + + { + when().get("/logging").then().body(is("hello")); + + List lines = TEST.getLogRecords().stream().map(formatter::format).collect(Collectors.toList()); + assertThat(lines).containsExactly("[INFO] hello"); + TEST.clearLogRecords(); + } + + TEST.modifySourceFile("LoggingEndpoint.java", s -> s.replace("hello", "hi")); + + { + when().get("/logging").then().body(is("hi")); + + List lines = TEST.getLogRecords().stream().map(formatter::format).collect(Collectors.toList()); + assertThat(lines).containsExactly("[INFO] hi"); + TEST.clearLogRecords(); + } + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheGeneratedTest.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheGeneratedTest.java new file mode 100644 index 00000000000000..044257cf5fabcc --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheGeneratedTest.java @@ -0,0 +1,24 @@ +package io.quarkus.logging; + +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.test.QuarkusUnitTest; + +public class LoggingWithPanacheGeneratedTest { + @RegisterExtension + static final QuarkusUnitTest test = new QuarkusUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addClasses(GeneratedBean.class, NoStackTraceTestException.class)) + .overrideConfigKey("quarkus.log.category.\"io.quarkus.logging\".min-level", "TRACE") + .overrideConfigKey("quarkus.log.category.\"io.quarkus.logging\".level", "TRACE"); + + @Test + public void test() { + new GeneratedBean().testLogging(); + // no asserts, this test only verifies that all Log methods can be successfully invoked + // (in other words, that the bytecode transformation isn't horribly broken) + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java new file mode 100644 index 00000000000000..d5c0fe5c3410a8 --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java @@ -0,0 +1,53 @@ +package io.quarkus.logging; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.logging.Formatter; +import java.util.stream.Collectors; + +import javax.inject.Inject; + +import org.jboss.logmanager.formatters.PatternFormatter; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.test.QuarkusUnitTest; + +public class LoggingWithPanacheTest { + @RegisterExtension + static final QuarkusUnitTest test = new QuarkusUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addClasses(LoggingBean.class, NoStackTraceTestException.class)) + .overrideConfigKey("quarkus.log.category.\"io.quarkus.logging\".min-level", "TRACE") + .overrideConfigKey("quarkus.log.category.\"io.quarkus.logging\".level", "TRACE") + .setLogRecordPredicate(record -> "io.quarkus.logging.LoggingBean".equals(record.getLoggerName())) + .assertLogRecords(records -> { + Formatter formatter = new PatternFormatter("[%p] %m"); + List lines = records.stream().map(formatter::format).collect(Collectors.toList()); + + assertThat(lines).containsExactly( + "[INFO] Heya!", + "[TRACE] LoggingBean created", + "[DEBUG] starting massive computation", + "[DEBUG] one: 42", + "[TRACE] two: 42 | 13", + "[DEBUG] three: 42 | 13 | 1", + "[DEBUG] one: foo", + "[INFO] two: foo | bar", + "[WARN] three: foo | bar | baz", + "[ERROR] four: foo | bar | baz | quux", + "[WARN] foo | bar | baz | quux: io.quarkus.logging.NoStackTraceTestException\n", + "[ERROR] Hello Error: io.quarkus.logging.NoStackTraceTestException\n"); + }); + + @Inject + LoggingBean bean; + + @Test + public void test() { + bean.doSomething(); + } +} diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/NoStackTraceTestException.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/NoStackTraceTestException.java new file mode 100644 index 00000000000000..9a3cf887ea1e9d --- /dev/null +++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/NoStackTraceTestException.java @@ -0,0 +1,8 @@ +package io.quarkus.logging; + +public class NoStackTraceTestException extends RuntimeException { + @Override + public synchronized Throwable fillInStackTrace() { + return this; + } +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index b13e0d4be40e02..99aaaa7a4d737d 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -157,6 +157,7 @@ native-config-profile logging-min-level-unset logging-min-level-set + logging-panache grpc-tls diff --git a/srcdeps.yaml b/srcdeps.yaml new file mode 100644 index 00000000000000..ce8de781efc233 --- /dev/null +++ b/srcdeps.yaml @@ -0,0 +1,12 @@ +configModelVersion: 3.0 +logToConsole: true +verbosity: info +repositories: + org.jboss.jandex: + includes: + - org.jboss:jandex + urls: + - git:https://github.com/Ladicek/jandex + buildVersionPattern: .*-SNAPSHOT + buildRef: branch-class-constant-indexing + skipTests: true diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java index bb291e63bd2d75..12f348836f2559 100644 --- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java +++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java @@ -136,6 +136,10 @@ public List getLogRecords() { return inMemoryLogHandler.records; } + public void clearLogRecords() { + inMemoryLogHandler.clearRecords(); + } + public Object createTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext extensionContext) throws TestInstantiationException { try {