refactor: optimize DfsService's log

This commit is contained in:
tjq 2023-08-14 23:14:07 +08:00
parent 58e542c69a
commit bdcc9b131d
4 changed files with 10 additions and 2 deletions

View File

@ -142,7 +142,7 @@ public class AliOssService extends AbstractDFsService {
}
this.oss = new OSSClientBuilder().build(endpoint, credentialsProvider);
log.info("[AliOssService] initialize OSS successfully!");
log.info("[AliOssService] initialize successfully, THIS_WILL_BE_THE_STORAGE_LAYER.");
}
@Override

View File

@ -1,5 +1,6 @@
package tech.powerjob.server.persistence.storage.impl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Conditional;
import tech.powerjob.server.extension.dfs.*;
@ -17,6 +18,7 @@ import java.util.Optional;
* @author tjq
* @since 2023/7/30
*/
@Slf4j
@Priority(value = Integer.MAX_VALUE)
@Conditional(EmptyDFsService.EmptyCondition.class)
public class EmptyDFsService extends AbstractDFsService {
@ -41,7 +43,7 @@ public class EmptyDFsService extends AbstractDFsService {
@Override
protected void init(ApplicationContext applicationContext) {
log.info("[EmptyDFsService] initialize successfully, THIS_WILL_BE_THE_STORAGE_LAYER.");
}

View File

@ -158,6 +158,8 @@ public class GridFsService extends AbstractDFsService {
protected void init(ApplicationContext applicationContext) {
String uri = parseMongoUri(applicationContext.getEnvironment());
initMongo(uri);
log.info("[GridFsService] initialize successfully, THIS_WILL_BE_THE_STORAGE_LAYER.");
}
public static class GridFsCondition extends PropertyAndOneBeanCondition {

View File

@ -17,6 +17,7 @@ import org.springframework.context.annotation.Conditional;
import org.springframework.core.env.Environment;
import tech.powerjob.common.serialize.JsonUtils;
import tech.powerjob.common.utils.CommonUtils;
import tech.powerjob.common.utils.NetUtils;
import tech.powerjob.server.common.constants.SwitchableStatus;
import tech.powerjob.server.common.spring.condition.PropertyAndOneBeanCondition;
import tech.powerjob.server.extension.dfs.*;
@ -138,6 +139,7 @@ public class MySqlSeriesDfsService extends AbstractDFsService {
deleteByLocation(fileLocation);
Map<String, Object> meta = Maps.newHashMap();
meta.put("_server_", NetUtils.getLocalHost());
meta.put("_local_file_path_", storeRequest.getLocalFile().getAbsolutePath());
Date date = new Date(System.currentTimeMillis());
@ -262,6 +264,8 @@ public class MySqlSeriesDfsService extends AbstractDFsService {
log.error("[MySqlSeriesDfsService] init datasource failed!", e);
ExceptionUtils.rethrow(e);
}
log.info("[MySqlSeriesDfsService] initialize successfully, THIS_WILL_BE_THE_STORAGE_LAYER.");
}
void initDatabase(MySQLProperty property) {