add temporary logs

This commit is contained in:
bgamard 2020-05-19 14:05:34 +02:00
parent d9ad69c7ff
commit 9b2aeb7480

View File

@ -76,11 +76,11 @@ public class FileProcessingAsyncListener {
@Subscribe @Subscribe
@AllowConcurrentEvents @AllowConcurrentEvents
public void on(final FileUpdatedAsyncEvent event) { public void on(final FileUpdatedAsyncEvent event) {
if (log.isInfoEnabled()) { log.info("File updated event: " + event.toString());
log.info("File updated event: " + event.toString());
}
TransactionUtil.handle(() -> { TransactionUtil.handle(() -> {
log.info("File processing phase 0: " + event.getFileId());
// Generate thumbnail, extract content // Generate thumbnail, extract content
File file = new FileDao().getActiveById(event.getFileId()); File file = new FileDao().getActiveById(event.getFileId());
if (file == null) { if (file == null) {
@ -91,6 +91,8 @@ public class FileProcessingAsyncListener {
// Update index with the file updated by side effect // Update index with the file updated by side effect
AppContext.getInstance().getIndexingHandler().updateFile(file); AppContext.getInstance().getIndexingHandler().updateFile(file);
log.info("File processing phase 6: " + file.getId());
}); });
FileUtil.endProcessingFile(event.getFileId()); FileUtil.endProcessingFile(event.getFileId());
@ -103,6 +105,8 @@ public class FileProcessingAsyncListener {
* @param file Fresh file * @param file Fresh file
*/ */
private void processFile(FileEvent event, File file) { private void processFile(FileEvent event, File file) {
log.info("File processing phase 1: " + file.getId());
// Find a format handler // Find a format handler
FormatHandler formatHandler = FormatHandlerUtil.find(file.getMimeType()); FormatHandler formatHandler = FormatHandlerUtil.find(file.getMimeType());
if (formatHandler == null) { if (formatHandler == null) {
@ -110,6 +114,8 @@ public class FileProcessingAsyncListener {
return; return;
} }
log.info("File processing phase 2: " + file.getId());
// Get the creating user from the database for its private key // Get the creating user from the database for its private key
UserDao userDao = new UserDao(); UserDao userDao = new UserDao();
User user = userDao.getById(file.getUserId()); User user = userDao.getById(file.getUserId());
@ -118,6 +124,8 @@ public class FileProcessingAsyncListener {
return; return;
} }
log.info("File processing phase 3: " + file.getId());
// Generate file variations // Generate file variations
try { try {
Cipher cipher = EncryptionUtil.getEncryptionCipher(user.getPrivateKey()); Cipher cipher = EncryptionUtil.getEncryptionCipher(user.getPrivateKey());
@ -144,6 +152,8 @@ public class FileProcessingAsyncListener {
log.error("Unable to generate thumbnails for: " + file, e); log.error("Unable to generate thumbnails for: " + file, e);
} }
log.info("File processing phase 4: " + file.getId());
// Extract text content from the file // Extract text content from the file
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
String content = null; String content = null;
@ -163,5 +173,7 @@ public class FileProcessingAsyncListener {
file.setContent(content); file.setContent(content);
fileDao.updateContent(file); fileDao.updateContent(file);
log.info("File processing phase 5: " + file.getId());
} }
} }