You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/05/11 13:50:58 UTC
[activemq-artemis] 13/23: progress - artemis-journal is compiling
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit be3dda15a470b20e60452bcfaef46f8ab514e532
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu May 5 15:57:15 2022 -0400
progress - artemis-journal is compiling
---
artemis-commons/pom.xml | 1 +
.../artemis/logs/AssertionLoggerHandler.java | 49 +++-
artemis-core-client/pom.xml | 2 +-
artemis-journal/pom.xml | 19 ++
.../artemis/core/io/AbstractSequentialFile.java | 7 +-
.../core/io/AbstractSequentialFileFactory.java | 5 +-
.../artemis/core/io/aio/AIOSequentialFile.java | 9 +-
.../core/io/aio/AIOSequentialFileFactory.java | 17 +-
.../artemis/core/io/buffer/TimedBuffer.java | 7 +-
.../artemis/core/io/mapped/MappedFile.java | 5 +-
.../artemis/core/io/nio/NIOSequentialFile.java | 9 +-
.../activemq/artemis/core/io/util/FileIOUtil.java | 5 +-
.../core/journal/impl/JournalCompactor.java | 5 +-
.../artemis/core/journal/impl/JournalFileImpl.java | 5 +-
.../core/journal/impl/JournalFilesRepository.java | 13 +-
.../artemis/core/journal/impl/JournalImpl.java | 13 +-
.../core/journal/impl/JournalTransaction.java | 5 +-
.../artemis/core/journal/impl/Reclaimer.java | 15 +-
.../artemis/journal/ActiveMQJournalBundle.java | 14 +-
.../artemis/journal/ActiveMQJournalLogger.java | 255 +++++++--------------
.../apache/activemq/artemis/core/TestDeleteme.java | 23 +-
.../artemis/logprocessor/LogProcessor.java | 7 +-
.../journal/impl/JournaHistorylBackupTest.java | 2 +-
23 files changed, 244 insertions(+), 248 deletions(-)
diff --git a/artemis-commons/pom.xml b/artemis-commons/pom.xml
index 6938c51287..9293681556 100644
--- a/artemis-commons/pom.xml
+++ b/artemis-commons/pom.xml
@@ -57,6 +57,7 @@
<artifactId>artemis-log-processor</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java
index d9701bbe3f..ca41f1bf37 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java
@@ -16,6 +16,53 @@
*/
package org.apache.activemq.artemis.logs;
+import java.util.logging.Level;
+
+
public class AssertionLoggerHandler {
-}
\ No newline at end of file
+ public void close() throws SecurityException {
+ }
+
+ public static boolean hasLevel(Level level) {
+ return false;
+ }
+
+ public static boolean findText(long mstimeout, String... text) {
+ return false;
+ }
+
+ /**
+ * Find a line that contains the parameters passed as an argument
+ *
+ * @param text
+ * @return
+ */
+ public static boolean findText(final String... text) {
+ return false;
+ }
+
+ public static int countText(final String... text) {
+ return 0;
+ }
+
+ public static boolean matchText(final String pattern) {
+ return false;
+ }
+
+ public static final void clear() {
+ }
+
+ public static final void startCapture() {
+ }
+
+ /**
+ *
+ * @param individualMessages enables counting individual messages.
+ */
+ public static final void startCapture(boolean individualMessages) {
+ }
+
+ public static final void stopCapture() {
+ }
+}
diff --git a/artemis-core-client/pom.xml b/artemis-core-client/pom.xml
index 0ca36f3977..7742abbd6a 100644
--- a/artemis-core-client/pom.xml
+++ b/artemis-core-client/pom.xml
@@ -38,6 +38,7 @@
<artifactId>artemis-log-processor</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -47,7 +48,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
-
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
diff --git a/artemis-journal/pom.xml b/artemis-journal/pom.xml
index 5f427d4113..c2b0d3d6e9 100644
--- a/artemis-journal/pom.xml
+++ b/artemis-journal/pom.xml
@@ -32,10 +32,19 @@
</properties>
<dependencies>
+
<!-- logging -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-log-processor</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
+ <!-- License: MIT -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -54,6 +63,16 @@
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-artemis-native</artifactId>
<version>${activemq-artemis-native-version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logmanager</groupId>
+ <artifactId>jboss-logmanager</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
index 7023cdf613..4cd59ecae8 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFile.java
@@ -38,11 +38,12 @@ import org.apache.activemq.artemis.core.journal.impl.SimpleWaitIOCallback;
import org.apache.activemq.artemis.journal.ActiveMQJournalBundle;
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.activemq.artemis.utils.ByteUtil;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
public abstract class AbstractSequentialFile implements SequentialFile {
- private static final Logger logger = Logger.getLogger(AbstractSequentialFile.class);
+ private static final Logger logger = LoggerFactory.getLogger(AbstractSequentialFile.class);
protected File file;
@@ -107,7 +108,7 @@ public abstract class AbstractSequentialFile implements SequentialFile {
@Override
public void copyTo(SequentialFile newFileName) throws Exception {
try {
- ActiveMQJournalLogger.LOGGER.debug("Copying " + this + " as " + newFileName);
+ logger.debug("Copying " + this + " as " + newFileName);
if (!newFileName.isOpen()) {
newFileName.open();
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFileFactory.java
index 66d0e84701..3359240235 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFileFactory.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/AbstractSequentialFileFactory.java
@@ -35,14 +35,15 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.critical.CriticalAnalyzer;
import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* An abstract SequentialFileFactory containing basic functionality for both AIO and NIO SequentialFactories
*/
public abstract class AbstractSequentialFileFactory implements SequentialFileFactory {
- private static final Logger logger = Logger.getLogger(AbstractSequentialFileFactory.class);
+ private static final Logger logger = LoggerFactory.getLogger(AbstractSequentialFileFactory.class);
// Timeout used to wait executors to shutdown
protected static final int EXECUTOR_TIMEOUT = 60;
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
index 5e46e3d73d..433a5f4192 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFile.java
@@ -32,12 +32,13 @@ import org.apache.activemq.artemis.core.io.SequentialFile;
import org.apache.activemq.artemis.core.journal.impl.SimpleWaitIOCallback;
import org.apache.activemq.artemis.nativo.jlibaio.LibaioFile;
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/** This class is implementing Runnable to reuse a callback to close it. */
public class AIOSequentialFile extends AbstractSequentialFile {
- private static final Logger logger = Logger.getLogger(AIOSequentialFileFactory.class);
+ private static final Logger logger = LoggerFactory.getLogger(AIOSequentialFileFactory.class);
private boolean opened = false;
@@ -227,7 +228,7 @@ public class AIOSequentialFile extends AbstractSequentialFile {
try {
checkOpened();
} catch (Exception e) {
- ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
completion.onError(-1, e.getMessage());
return;
}
@@ -251,7 +252,7 @@ public class AIOSequentialFile extends AbstractSequentialFile {
try {
checkOpened();
} catch (Exception e) {
- ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
callback.onError(-1, e.getMessage());
return;
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
index 1676242f5d..d1c6d34b64 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java
@@ -41,13 +41,14 @@ import org.apache.activemq.artemis.nativo.jlibaio.SubmitInfo;
import org.apache.activemq.artemis.utils.ByteUtil;
import org.apache.activemq.artemis.utils.PowerOf2Util;
import org.apache.activemq.artemis.utils.critical.CriticalAnalyzer;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
import org.jctools.queues.MpmcArrayQueue;
import org.jctools.queues.atomic.MpmcAtomicArrayQueue;
public final class AIOSequentialFileFactory extends AbstractSequentialFileFactory {
- private static final Logger logger = Logger.getLogger(AIOSequentialFileFactory.class);
+ private static final Logger logger = LoggerFactory.getLogger(AIOSequentialFileFactory.class);
// This is useful in cases where you want to disable loading the native library. (e.g. testsuite)
private static final boolean DISABLED = System.getProperty(AIOSequentialFileFactory.class.getName() + ".DISABLED") != null;
@@ -107,7 +108,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
final CriticalAnalyzer analyzer) {
super(journalDir, true, bufferSize, bufferTimeout, maxIO, logRates, listener, analyzer);
if (maxIO == 1) {
- ActiveMQJournalLogger.LOGGER.warn("Using journal-max-io 1 isn't a proper use of ASYNCIO journal: consider rise this value or use NIO.");
+ logger.warn("Using journal-max-io 1 isn't a proper use of ASYNCIO journal: consider rise this value or use NIO.");
}
final int adjustedMaxIO = Math.max(2, maxIO);
callbackPool = PlatformDependent.hasUnsafe() ? new MpmcArrayQueue<>(adjustedMaxIO) : new MpmcAtomicArrayQueue<>(adjustedMaxIO);
@@ -318,14 +319,6 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
}
}
- static void threadDump(String message) {
- ActiveMQJournalLogger.LOGGER.warn(message);
- final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
- for (ThreadInfo threadInfo : threads) {
- ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString());
- }
- }
-
/**
* The same callback is used for Runnable executor.
* This way we can save some memory over the pool.
@@ -455,7 +448,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
try {
libaioContext.poll();
} catch (Throwable e) {
- ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
onIOError(new ActiveMQException("Error on libaio poll"), e.getMessage(), null);
}
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
index 6fc2616264..6182927a03 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
@@ -35,7 +35,8 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.activemq.artemis.utils.ArtemisCloseable;
import org.apache.activemq.artemis.utils.critical.CriticalAnalyzer;
import org.apache.activemq.artemis.utils.critical.CriticalComponentImpl;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
public final class TimedBuffer extends CriticalComponentImpl {
@@ -47,7 +48,7 @@ public final class TimedBuffer extends CriticalComponentImpl {
protected static final int CRITICAL_PATH_ADD_BYTES = 4;
protected static final int CRITICAL_PATH_SET_OBSERVER = 5;
- private static final Logger logger = Logger.getLogger(TimedBuffer.class);
+ private static final Logger logger = LoggerFactory.getLogger(TimedBuffer.class);
private static final double MAX_TIMEOUT_ERROR_FACTOR = 1.5;
@@ -200,7 +201,7 @@ public final class TimedBuffer extends CriticalComponentImpl {
bufferObserver = observer;
}
} catch (Exception shouldNotHappen) {
- logger.debug(shouldNotHappen);
+ logger.debug(shouldNotHappen.getMessage(), shouldNotHappen);
}
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java
index a6431172b9..0d5e34f2be 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedFile.java
@@ -30,11 +30,12 @@ import org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.utils.PowerOf2Util;
import org.apache.activemq.artemis.utils.Env;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
final class MappedFile implements AutoCloseable {
- private static final Logger logger = Logger.getLogger(MappedFile.class);
+ private static final Logger logger = LoggerFactory.getLogger(MappedFile.class);
private static final int OS_PAGE_SIZE = Env.osPageSize();
private final MappedByteBuffer buffer;
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
index eb4ff8d3a9..6c00295a12 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFile.java
@@ -42,11 +42,14 @@ import org.apache.activemq.artemis.core.io.SequentialFile;
import org.apache.activemq.artemis.core.io.SequentialFileFactory;
import org.apache.activemq.artemis.core.io.buffer.TimedBufferObserver;
import org.apache.activemq.artemis.journal.ActiveMQJournalBundle;
-import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.activemq.artemis.utils.Env;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NIOSequentialFile extends AbstractSequentialFile {
+ private static final Logger logger = LoggerFactory.getLogger(NIOSequentialFile.class);
+
private static final boolean DEBUG_OPENS = false;
/* This value has been tuned just to reduce the memory footprint
@@ -447,8 +450,8 @@ public class NIOSequentialFile extends AbstractSequentialFile {
@Override
public void copyTo(SequentialFile dstFile) throws IOException {
- if (ActiveMQJournalLogger.LOGGER.isDebugEnabled()) {
- ActiveMQJournalLogger.LOGGER.debug("Copying " + this + " as " + dstFile);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Copying " + this + " as " + dstFile);
}
if (isOpen()) {
throw new IllegalStateException("File opened!");
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/util/FileIOUtil.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/util/FileIOUtil.java
index 705aaaad98..90595fec27 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/util/FileIOUtil.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/util/FileIOUtil.java
@@ -20,11 +20,12 @@ package org.apache.activemq.artemis.core.io.util;
import java.nio.ByteBuffer;
import org.apache.activemq.artemis.core.io.SequentialFile;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
public class FileIOUtil {
- private static final Logger logger = Logger.getLogger(FileIOUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(FileIOUtil.class);
public static void copyData(SequentialFile from, SequentialFile to, ByteBuffer buffer) throws Exception {
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
index fb8e0f7860..9dd43a32bc 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
@@ -38,11 +38,12 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.activemq.artemis.utils.RunnableEx;
import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
public class JournalCompactor extends AbstractJournalUpdateTask implements JournalRecordProvider {
- private static final Logger logger = Logger.getLogger(JournalCompactor.class);
+ private static final Logger logger = LoggerFactory.getLogger(JournalCompactor.class);
LongObjectHashMap<LinkedList<RunnableEx>> pendingWritesOnTX = new LongObjectHashMap<>();
IntObjectHashMap<LongObjectHashMap<RunnableEx>> pendingUpdates = new IntObjectHashMap<>();
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java
index 4b406be090..04ca0f27b0 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java
@@ -23,7 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.activemq.artemis.core.io.SequentialFile;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
import static org.apache.activemq.artemis.utils.Preconditions.checkNotNull;
@@ -64,7 +65,7 @@ public class JournalFileImpl implements JournalFile {
private final ConcurrentMap<JournalFile, AtomicInteger> negCounts = new ConcurrentHashMap<>();
- private static final Logger logger = Logger.getLogger(JournalFileImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(JournalFileImpl.class);
public JournalFileImpl(final SequentialFile file, final long fileID, final int version) {
checkNotNull(file);
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
index 0c715735a7..d7bd882248 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java
@@ -41,7 +41,8 @@ import org.apache.activemq.artemis.core.io.SequentialFile;
import org.apache.activemq.artemis.core.io.SequentialFileFactory;
import org.apache.activemq.artemis.journal.ActiveMQJournalBundle;
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* This is a helper class for the Journal, which will control access to dataFiles, openedFiles and freeFiles
@@ -49,7 +50,7 @@ import org.jboss.logging.Logger;
*/
public class JournalFilesRepository {
- private static final Logger logger = Logger.getLogger(JournalFilesRepository.class);
+ private static final Logger logger = LoggerFactory.getLogger(JournalFilesRepository.class);
/**
* Used to debug the consistency of the journal ordering.
@@ -291,14 +292,14 @@ public class JournalFilesRepository {
for (JournalFile file : dataFiles) {
if (file.getFileID() <= seq) {
ActiveMQJournalLogger.LOGGER.checkFiles();
- ActiveMQJournalLogger.LOGGER.info(debugFiles());
+ logger.info(debugFiles());
ActiveMQJournalLogger.LOGGER.seqOutOfOrder();
throw new IllegalStateException("Sequence out of order");
}
if (journal.getCurrentFile() != null && journal.getCurrentFile().getFileID() <= file.getFileID()) {
ActiveMQJournalLogger.LOGGER.checkFiles();
- ActiveMQJournalLogger.LOGGER.info(debugFiles());
+ logger.info(debugFiles());
ActiveMQJournalLogger.LOGGER.currentFile(file.getFileID(), journal.getCurrentFile().getFileID(), file.getFileID(), (journal.getCurrentFile() == file));
// throw new RuntimeException ("Check failure!");
@@ -315,7 +316,7 @@ public class JournalFilesRepository {
for (JournalFile file : freeFiles) {
if (file.getFileID() <= lastFreeId) {
ActiveMQJournalLogger.LOGGER.checkFiles();
- ActiveMQJournalLogger.LOGGER.info(debugFiles());
+ logger.info(debugFiles());
ActiveMQJournalLogger.LOGGER.fileIdOutOfOrder();
throw new RuntimeException("Check failure!");
@@ -325,7 +326,7 @@ public class JournalFilesRepository {
if (file.getFileID() < seq) {
ActiveMQJournalLogger.LOGGER.checkFiles();
- ActiveMQJournalLogger.LOGGER.info(debugFiles());
+ logger.info(debugFiles());
ActiveMQJournalLogger.LOGGER.fileTooSmall();
// throw new RuntimeException ("Check failure!");
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
index 5ba981a3ba..cf94b0242c 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
@@ -91,7 +91,8 @@ import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
import org.apache.activemq.artemis.utils.collections.LongHashSet;
import org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
import static org.apache.activemq.artemis.core.journal.impl.Reclaimer.scan;
@@ -100,7 +101,7 @@ import static org.apache.activemq.artemis.core.journal.impl.Reclaimer.scan;
* <p>Look at {@link JournalImpl#load(LoaderCallback)} for the file layout
*/
public class JournalImpl extends JournalBase implements TestableJournal, JournalRecordProvider {
- private static final Logger logger = Logger.getLogger(JournalImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(JournalImpl.class);
/**
@@ -481,7 +482,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
try {
return "JournalImpl(state=" + state + ", directory=[" + this.fileFactory.getDirectory().toString() + "], hash=" + super.toString() + ")";
} catch (Throwable e) {
- logger.warn(e);
+ logger.warn(e.getMessage(), e);
return super.toString();
}
}
@@ -1743,13 +1744,13 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
// HORNETQ-482 - Flush deletes only if memory is critical
if (recordsToDelete.size() > DELETE_FLUSH && runtime.freeMemory() < runtime.maxMemory() * 0.2) {
if (logger.isDebugEnabled()) {
- logger.debugf("Flushing deletes during loading, deleteCount = %d", recordsToDelete.size());
+ logger.debug("Flushing deletes during loading, deleteCount = %d", recordsToDelete.size());
}
// Clean up when the list is too large, or it won't be possible to load large sets of files
// Done as part of JBMESSAGING-1678
final long removed = committedRecords.remove(toDeleteFilter);
if (logger.isDebugEnabled()) {
- logger.debugf("Removed records during loading = %d", removed);
+ logger.debug("Removed records during loading = %d", removed);
}
recordsToDelete.clear();
@@ -2994,7 +2995,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
latch.countDown();
}
} catch (Throwable e) {
- ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
}
fileFactory.deactivateBuffer();
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
index d557201580..df53d1e4ae 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
@@ -28,11 +28,12 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
public class JournalTransaction {
- private static final Logger logger = Logger.getLogger(JournalTransaction.class);
+ private static final Logger logger = LoggerFactory.getLogger(JournalTransaction.class);
private JournalRecordProvider journal;
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
index 5fbe69bee0..b21237fcc3 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
@@ -16,7 +16,8 @@
*/
package org.apache.activemq.artemis.core.journal.impl;
-import org.jboss.logging.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
* <p>The journal consists of an ordered list of journal files Fn where {@code 0 <= n <= N}</p>
@@ -34,7 +35,7 @@ import org.jboss.logging.Logger;
*/
public final class Reclaimer {
- private static final Logger logger = Logger.getLogger(Reclaimer.class);
+ private static final Logger logger = LoggerFactory.getLogger(Reclaimer.class);
private Reclaimer() {
}
@@ -54,7 +55,7 @@ public final class Reclaimer {
for (int j = i - 1; j >= 0 && !outstandingNeg; j--) {
JournalFile file = files[j];
if (!file.isCanReclaim() && currentFile.getNegCount(file) != 0) {
- logger.tracef("%s can't be reclaimed because %s has negative values", currentFile, file);
+ logger.trace("%s can't be reclaimed because %s has negative values", currentFile, file);
outstandingNeg = true;
}
}
@@ -69,21 +70,21 @@ public final class Reclaimer {
// criterion 1) --- this files additions all have matching deletes
if (!currentFile.isPosReclaimCriteria()) {
int negCount = 0, posCount = currentFile.getPosCount();
- logger.tracef("posCount on %s = %d", currentFile, posCount);
+ logger.trace("posCount on %s = %d", currentFile, posCount);
for (int j = i; j < files.length && negCount < posCount; j++) {
int toNeg = files[j].getNegCount(currentFile);
negCount += toNeg;
if (logger.isTraceEnabled() && toNeg != 0) {
- logger.tracef("Negative from %s into %s = %d", files[j], currentFile, toNeg);
+ logger.trace("Negative from %s into %s = %d", files[j], currentFile, toNeg);
}
}
if (negCount < posCount) {
- logger.tracef("%s can't be reclaimed because there are not enough negatives %d", currentFile, negCount);
+ logger.trace("%s can't be reclaimed because there are not enough negatives %d", currentFile, negCount);
} else {
- logger.tracef("%s can be reclaimed", currentFile);
+ logger.trace("%s can be reclaimed", currentFile);
currentFile.setPosReclaimCriteria();
}
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
index a9bda017b1..baf9057c5c 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
@@ -17,9 +17,9 @@
package org.apache.activemq.artemis.journal;
import org.apache.activemq.artemis.api.core.ActiveMQIOErrorException;
-import org.jboss.logging.Messages;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageBundle;
+import org.apache.activemq.artemis.logprocessor.CodeFactory;
+import org.apache.activemq.artemis.logprocessor.annotation.LogBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.Message;
/**
* Logger Code 14
@@ -28,12 +28,12 @@ import org.jboss.logging.annotations.MessageBundle;
*
* so 149000 to 149999
*/
-@MessageBundle(projectCode = "AMQ")
+@LogBundle(projectCode = "AMQ")
public interface ActiveMQJournalBundle {
- ActiveMQJournalBundle BUNDLE = Messages.getBundle(ActiveMQJournalBundle.class);
+ ActiveMQJournalBundle BUNDLE = CodeFactory.getCodeClass(ActiveMQJournalBundle.class);
- @Message(id = 149000, value = "failed to rename file {0} to {1}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 149000, value = "failed to rename file {0} to {1}")
ActiveMQIOErrorException ioRenameFileError(String name, String newFileName);
@Message(id = 149001, value = "Journal data belong to a different version")
@@ -48,6 +48,6 @@ public interface ActiveMQJournalBundle {
@Message(id = 149004, value = "unable to open file")
String unableToOpenFile();
- @Message(id = 149005, value = "Message of {0} bytes is bigger than the max record size of {1} bytes. You should try to move large application properties to the message body.", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 149005, value = "Message of {0} bytes is bigger than the max record size of {1} bytes. You should try to move large application properties to the message body.")
ActiveMQIOErrorException recordLargerThanStoreMax(long recordSize, long maxRecordSize);
}
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
index b049923bc3..721c89c06c 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
@@ -17,281 +17,190 @@
package org.apache.activemq.artemis.journal;
import org.apache.activemq.artemis.core.journal.impl.JournalFile;
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
-import org.jboss.logging.annotations.Cause;
-import org.jboss.logging.annotations.LogMessage;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageLogger;
+import org.apache.activemq.artemis.logprocessor.CodeFactory;
+import org.apache.activemq.artemis.logprocessor.annotation.LogBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
/**
* Logger Code 14
- *
- * each message id must be 6 digits long starting with 14, the 3rd digit donates the level so
- *
- * INF0 1
- * WARN 2
- * DEBUG 3
- * ERROR 4
- * TRACE 5
- * FATAL 6
- *
- * so an INFO message would be 141000 to 141999
*/
-@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQJournalLogger extends BasicLogger {
+@LogBundle(projectCode = "AMQ")
+public interface ActiveMQJournalLogger {
/**
* The journal logger.
*/
- ActiveMQJournalLogger LOGGER = Logger.getMessageLogger(ActiveMQJournalLogger.class, ActiveMQJournalLogger.class.getPackage().getName());
+ ActiveMQJournalLogger LOGGER = CodeFactory.getCodeClass(ActiveMQJournalLogger.class, ActiveMQJournalLogger.class.getPackage().getName());
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141000, value = "*** running direct journal blast: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141000, value = "*** running direct journal blast: {0}", level = LogMessage.Level.INFO)
void runningJournalBlast(Integer numIts);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141002, value = "starting thread for sync speed test", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141002, value = "starting thread for sync speed test", level = LogMessage.Level.INFO)
void startingThread();
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141003, value = "Write rate = {0} bytes / sec or {1} MiB / sec", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141003, value = "Write rate = {0} bytes / sec or {1} MiB / sec", level = LogMessage.Level.INFO)
void writeRate(Double rate, Long l);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141004, value = "Flush rate = {0} flushes / sec", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141004, value = "Flush rate = {0} flushes / sec", level = LogMessage.Level.INFO)
void flushRate(Double rate);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141005, value = "Check Data Files:", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141005, value = "Check Data Files:", level = LogMessage.Level.INFO)
void checkFiles();
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141006, value = "Sequence out of order on journal", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141006, value = "Sequence out of order on journal", level = LogMessage.Level.INFO)
void seqOutOfOrder();
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141007, value = "Current File on the journal is <= the sequence file.getFileID={0} on the dataFiles" +
- "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" +
- "\nIs same = ({3})",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141007, value = "Current File on the journal is <= the sequence file.getFileID={0} on the dataFiles" + "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" + "\nIs same = ({3})", level = LogMessage.Level.INFO)
void currentFile(Long fileID, Long id, Long fileFileID, Boolean b);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141008, value = "Free File ID out of order", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141008, value = "Free File ID out of order", level = LogMessage.Level.INFO)
void fileIdOutOfOrder();
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141009, value = "A Free File is less than the maximum data", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141009, value = "A Free File is less than the maximum data", level = LogMessage.Level.INFO)
void fileTooSmall();
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 141010, value = "Initialising JDBC data source {0} with properties {1}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 141010, value = "Initialising JDBC data source {0} with properties {1}", level = LogMessage.Level.INFO)
void initializingJdbcDataSource(String dataSourceClassName, String dataSourceProperties);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142000, value = "You have a native library with a different version than expected", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142000, value = "You have a native library with a different version than expected", level = LogMessage.Level.WARN)
void incompatibleNativeLibrary();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142001, value = "Could not get lock after 60 seconds on closing Asynchronous File: {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142001, value = "Could not get lock after 60 seconds on closing Asynchronous File: {0}", level = LogMessage.Level.WARN)
void couldNotGetLock(String fileName);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142002, value = "Asynchronous File: {0} being finalized with opened state", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142002, value = "Asynchronous File: {0} being finalized with opened state", level = LogMessage.Level.WARN)
void fileFinalizedWhileOpen(String fileName);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142003, value = "AIO Callback Error: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142003, value = "AIO Callback Error: {0}", level = LogMessage.Level.WARN)
void callbackError(String error);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142004, value = "Inconsistency during compacting: CommitRecord ID = {0} for an already committed transaction during compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142004, value = "Inconsistency during compacting: CommitRecord ID = {0} for an already committed transaction during compacting", level = LogMessage.Level.WARN)
void inconsistencyDuringCompacting(Long transactionID);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142005, value = "Inconsistency during compacting: Delete record being read on an existent record (id={0})",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142005, value = "Inconsistency during compacting: Delete record being read on an existent record (id={0})", level = LogMessage.Level.WARN)
void inconsistencyDuringCompactingDelete(Long recordID);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142006, value = "Could not find add Record information for record {0} during compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142006, value = "Could not find add Record information for record {0} during compacting", level = LogMessage.Level.WARN)
void compactingWithNoAddRecord(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142007, value = "Can not find record {0} during compact replay",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142007, value = "Can not find record {0} during compact replay", level = LogMessage.Level.WARN)
void noRecordDuringCompactReplay(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142008, value = "Could not remove file {0} from the list of data files",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142008, value = "Could not remove file {0} from the list of data files", level = LogMessage.Level.WARN)
void couldNotRemoveFile(JournalFile file);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142009, value = "*******************************************************************************************************************************\nThe File Storage Attic is full, as the file {0} does not have the configured size, and the file will be removed\n*******************************************************************************************************************************",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142009, value = "*******************************************************************************************************************************\nThe File Storage Attic is full, as the file {0} does not have the configured size, and the file will be removed\n*******************************************************************************************************************************", level = LogMessage.Level.WARN)
void deletingFile(JournalFile file);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142010, value = "Failed to add file to opened files queue: {0}. This should NOT happen!",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142010, value = "Failed to add file to opened files queue: {0}. This should NOT happen!", level = LogMessage.Level.WARN)
void failedToAddFile(JournalFile nextOpenedFile);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142011, value = "Error on reading compacting for {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142011, value = "Error on reading compacting for {0}", level = LogMessage.Level.WARN)
void compactReadError(JournalFile file);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142012, value = "Couldn''t find tx={0} to merge after compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142012, value = "Couldn''t find tx={0} to merge after compacting", level = LogMessage.Level.WARN)
void compactMergeError(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142013, value = "Prepared transaction {0} was not considered completed, it will be ignored",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142013, value = "Prepared transaction {0} was not considered completed, it will be ignored", level = LogMessage.Level.WARN)
void preparedTXIncomplete(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142014, value = "Transaction {0} is missing elements so the transaction is being ignored",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142014, value = "Transaction {0} is missing elements so the transaction is being ignored", level = LogMessage.Level.WARN)
void txMissingElements(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142015, value = "Uncommitted transaction with id {0} found and discarded",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142015, value = "Uncommitted transaction with id {0} found and discarded", level = LogMessage.Level.WARN)
void uncomittedTxFound(Long id);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142016, value = "Could not stop compactor executor after 120 seconds",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142016, value = "Could not stop compactor executor after 120 seconds", level = LogMessage.Level.WARN)
void couldNotStopCompactor();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142017, value = "Could not stop journal executor after 60 seconds",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142017, value = "Could not stop journal executor after 60 seconds", level = LogMessage.Level.WARN)
void couldNotStopJournalExecutor();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142018, value = "Temporary files were left unattended after a crash on journal directory, deleting invalid files now",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142018, value = "Temporary files were left unattended after a crash on journal directory, deleting invalid files now", level = LogMessage.Level.WARN)
void tempFilesLeftOpen();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142019, value = "Deleting orphaned file {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142019, value = "Deleting orphaned file {0}", level = LogMessage.Level.WARN)
void deletingOrphanedFile(String fileToDelete);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142020, value = "Could not get lock after 60 seconds on closing Asynchronous File: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142020, value = "Could not get lock after 60 seconds on closing Asynchronous File: {0}", level = LogMessage.Level.WARN)
void errorClosingFile(String fileToDelete);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142021, value = "Error on IO callback, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142021, value = "Error on IO callback, {0}", level = LogMessage.Level.WARN)
void errorOnIOCallback(String errorMessage);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142022, value = "Timed out on AIO poller shutdown", format = Message.Format.MESSAGE_FORMAT)
- void timeoutOnPollerShutdown(@Cause Exception e);
+ @LogMessage(id = 142022, value = "Timed out on AIO poller shutdown", level = LogMessage.Level.WARN)
+ void timeoutOnPollerShutdown(Exception e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142023, value = "Executor on file {0} couldn''t complete its tasks in 60 seconds.", format = Message.Format.MESSAGE_FORMAT)
- void couldNotCompleteTask(@Cause Exception e, String name);
+ @LogMessage(id = 142023, value = "Executor on file {0} couldn''t complete its tasks in 60 seconds.", level = LogMessage.Level.WARN)
+ void couldNotCompleteTask(Exception e, String name);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142024, value = "Error completing callback", format = Message.Format.MESSAGE_FORMAT)
- void errorCompletingCallback(@Cause Throwable e);
+ @LogMessage(id = 142024, value = "Error completing callback", level = LogMessage.Level.WARN)
+ void errorCompletingCallback(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142025, value = "Error calling onError callback", format = Message.Format.MESSAGE_FORMAT)
- void errorCallingErrorCallback(@Cause Throwable e);
+ @LogMessage(id = 142025, value = "Error calling onError callback", level = LogMessage.Level.WARN)
+ void errorCallingErrorCallback(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142026, value = "Timed out on AIO writer shutdown", format = Message.Format.MESSAGE_FORMAT)
- void timeoutOnWriterShutdown(@Cause Throwable e);
+ @LogMessage(id = 142026, value = "Timed out on AIO writer shutdown", level = LogMessage.Level.WARN)
+ void timeoutOnWriterShutdown(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142027, value = "Error on writing data! {0} code - {1}", format = Message.Format.MESSAGE_FORMAT)
- void errorWritingData(@Cause Throwable e, String errorMessage, Integer errorCode);
+ @LogMessage(id = 142027, value = "Error on writing data! {0} code - {1}", level = LogMessage.Level.WARN)
+ void errorWritingData(Throwable e, String errorMessage, Integer errorCode);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142028, value = "Error replaying pending commands after compacting", format = Message.Format.MESSAGE_FORMAT)
- void errorReplayingCommands(@Cause Throwable e);
+ @LogMessage(id = 142028, value = "Error replaying pending commands after compacting", level = LogMessage.Level.WARN)
+ void errorReplayingCommands(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142029, value = "Error closing file", format = Message.Format.MESSAGE_FORMAT)
- void errorClosingFile(@Cause Throwable e);
+ @LogMessage(id = 142029, value = "Error closing file", level = LogMessage.Level.WARN)
+ void errorClosingFile(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142030, value = "Could not open a file in 60 Seconds", format = Message.Format.MESSAGE_FORMAT)
- void errorOpeningFile(@Cause Throwable e);
+ @LogMessage(id = 142030, value = "Could not open a file in 60 Seconds", level = LogMessage.Level.WARN)
+ void errorOpeningFile(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142031, value = "Error retrieving ID part of the file name {0}", format = Message.Format.MESSAGE_FORMAT)
- void errorRetrievingID(@Cause Throwable e, String fileName);
+ @LogMessage(id = 142031, value = "Error retrieving ID part of the file name {0}", level = LogMessage.Level.WARN)
+ void errorRetrievingID(Throwable e, String fileName);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142032, value = "Error reading journal file", format = Message.Format.MESSAGE_FORMAT)
- void errorReadingFile(@Cause Throwable e);
+ @LogMessage(id = 142032, value = "Error reading journal file", level = LogMessage.Level.WARN)
+ void errorReadingFile(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142033, value = "Error reinitializing file {0}", format = Message.Format.MESSAGE_FORMAT)
- void errorReinitializingFile(@Cause Throwable e, JournalFile file);
+ @LogMessage(id = 142033, value = "Error reinitializing file {0}", level = LogMessage.Level.WARN)
+ void errorReinitializingFile(Throwable e, JournalFile file);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142034, value = "Exception on submitting write", format = Message.Format.MESSAGE_FORMAT)
- void errorSubmittingWrite(@Cause Throwable e);
+ @LogMessage(id = 142034, value = "Exception on submitting write", level = LogMessage.Level.WARN)
+ void errorSubmittingWrite(Throwable e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 142035, value = "Could not stop journal append executor after 60 seconds", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 142035, value = "Could not stop journal append executor after 60 seconds", level = LogMessage.Level.WARN)
void couldNotStopJournalAppendExecutor();
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144000, value = "Failed to delete file {0}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 144000, value = "Failed to delete file {0}", level = LogMessage.Level.ERROR)
void errorDeletingFile(Object e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144001, value = "Error starting poller", format = Message.Format.MESSAGE_FORMAT)
- void errorStartingPoller(@Cause Exception e);
+ @LogMessage(id = 144001, value = "Error starting poller", level = LogMessage.Level.ERROR)
+ void errorStartingPoller(Exception e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144002, value = "Error pushing opened file", format = Message.Format.MESSAGE_FORMAT)
- void errorPushingFile(@Cause Exception e);
+ @LogMessage(id = 144002, value = "Error pushing opened file", level = LogMessage.Level.ERROR)
+ void errorPushingFile(Exception e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144003, value = "Error compacting", format = Message.Format.MESSAGE_FORMAT)
- void errorCompacting(@Cause Throwable e);
+ @LogMessage(id = 144003, value = "Error compacting", level = LogMessage.Level.ERROR)
+ void errorCompacting(Throwable e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144004, value = "Error scheduling compacting", format = Message.Format.MESSAGE_FORMAT)
- void errorSchedulingCompacting(@Cause Throwable e);
+ @LogMessage(id = 144004, value = "Error scheduling compacting", level = LogMessage.Level.ERROR)
+ void errorSchedulingCompacting(Throwable e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144005, value = "Failed to performance blast", format = Message.Format.MESSAGE_FORMAT)
- void failedToPerfBlast(@Cause Throwable e);
+ @LogMessage(id = 144005, value = "Failed to performance blast", level = LogMessage.Level.ERROR)
+ void failedToPerfBlast(Throwable e);
- @LogMessage(level = Logger.Level.ERROR)
- @Message(id = 144006, value = "IOError code {0}, {1}", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 144006, value = "IOError code {0}, {1}", level = LogMessage.Level.ERROR)
void ioError(int errorCode, String errorMessage);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 144007, value = "Ignoring journal file {0}: file is shorter then minimum header size. This file is being removed.", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 144007, value = "Ignoring journal file {0}: file is shorter then minimum header size. This file is being removed.", level = LogMessage.Level.WARN)
void ignoringShortFile(String fileName);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 144008, value = "*******************************************************************************************************************************\nFile {0}: was moved under attic, please review it and remove it.\n*******************************************************************************************************************************", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 144008, value = "*******************************************************************************************************************************\nFile {0}: was moved under attic, please review it and remove it.\n*******************************************************************************************************************************", level = LogMessage.Level.WARN)
void movingFileToAttic(String fileName);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 144009, value = "Could not get a file in {0} seconds, System will retry the open but you may see increased latency in your system", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 144009, value = "Could not get a file in {0} seconds, System will retry the open but you may see increased latency in your system", level = LogMessage.Level.WARN)
void cantOpenFileTimeout(long timeout);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 144010, value = "Critical IO Exception happened: {0}", format = Message.Format.MESSAGE_FORMAT)
- void criticalIO(String message, @Cause Exception error);
-
+ @LogMessage(id = 144010, value = "Critical IO Exception happened: {0}", level = LogMessage.Level.WARN)
+ void criticalIO(String message, Exception error);
}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/TestDeleteme.java
similarity index 69%
copy from artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java
copy to artemis-journal/src/test/java/org/apache/activemq/artemis/core/TestDeleteme.java
index d9701bbe3f..6175bb0c77 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AssertionLoggerHandler.java
+++ b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/TestDeleteme.java
@@ -1,21 +1,30 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.artemis.logs;
-public class AssertionLoggerHandler {
+package org.apache.activemq.artemis.core;
-}
\ No newline at end of file
+import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
+import org.junit.Test;
+
+public class TestDeleteme {
+
+ @Test
+ public void test() {
+ ActiveMQJournalLogger.LOGGER.callbackError("PQP");
+ }
+
+}
diff --git a/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java b/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
index fee6225039..7c606a65bc 100644
--- a/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
+++ b/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
@@ -28,6 +28,7 @@ import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
@@ -38,7 +39,7 @@ import org.apache.activemq.artemis.logprocessor.annotation.GetLogger;
import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
import org.apache.activemq.artemis.logprocessor.annotation.Message;
-@SupportedAnnotationTypes({"org.apache.activemq.artemis.logprocessor.annotation.ArtemisBundle"})
+@SupportedAnnotationTypes({"org.apache.activemq.artemis.logprocessor.annotation.LogBundle"})
@SupportedSourceVersion(SourceVersion.RELEASE_11)
public class LogProcessor extends AbstractProcessor {
@@ -68,7 +69,9 @@ public class LogProcessor extends AbstractProcessor {
String fullClassName = annotatedType.getQualifiedName() + "_impl";
String interfaceName = annotatedType.getSimpleName().toString();
String simpleClassName = interfaceName + "_impl";
- PrintWriter writerOutput = new PrintWriter(processingEnv.getFiler().createSourceFile(fullClassName).openWriter());
+ JavaFileObject fileObject = processingEnv.getFiler().createSourceFile(fullClassName);
+ System.out.println("file::" + fileObject);
+ PrintWriter writerOutput = new PrintWriter(fileObject.openWriter());
// header
writerOutput.println("/** This class is auto generated by " + LogProcessor.class.getCanonicalName());
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournaHistorylBackupTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournaHistorylBackupTest.java
index dda55c286e..0c62fb79ae 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournaHistorylBackupTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournaHistorylBackupTest.java
@@ -309,4 +309,4 @@ public class JournaHistorylBackupTest extends ActiveMQTestBase {
}
-}
+}
\ No newline at end of file