增加es异常日志

This commit is contained in:
paulGao 2021-11-03 15:25:28 +08:00
parent 676c432ded
commit 58ce721674
2 changed files with 6 additions and 1 deletions

View File

@ -542,8 +542,10 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
goodsWords.setSort(0); goodsWords.setSort(0);
goodsWordsService.save(goodsWords); goodsWordsService.save(goodsWords);
} }
} catch (MyBatisSystemException e) { } catch (MyBatisSystemException me) {
log.error(words + "关键字已存在!"); log.error(words + "关键字已存在!");
} catch (Exception e) {
log.error("关键字入库异常!", e);
} }
} }

View File

@ -26,6 +26,7 @@ import cn.lili.modules.store.entity.dos.StoreGoodsLabel;
import cn.lili.modules.store.service.StoreGoodsLabelService; import cn.lili.modules.store.service.StoreGoodsLabelService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -47,6 +48,7 @@ import java.util.Map;
@RestController @RestController
@Api(tags = "ES初始化接口") @Api(tags = "ES初始化接口")
@RequestMapping("/manager/elasticsearch") @RequestMapping("/manager/elasticsearch")
@Slf4j
public class ElasticsearchController { public class ElasticsearchController {
@Autowired @Autowired
@ -133,6 +135,7 @@ public class ElasticsearchController {
} catch (Exception e) { } catch (Exception e) {
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), null); cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), null);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false); cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false);
log.error("初始化索引异常", e);
} }
}); });
return ResultUtil.success(); return ResultUtil.success();