Skip to content

Commit

Permalink
update log push lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohann0617 committed Dec 27, 2024
1 parent e9a4b99 commit 7ce9037
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.yohann.ocihelper.config;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.file.Tailer;
import cn.hutool.jwt.JWTUtil;
import com.yohann.ocihelper.utils.CommonUtils;
Expand All @@ -10,10 +12,14 @@
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.concurrent.*;

import static com.yohann.ocihelper.service.impl.OciServiceImpl.TEMP_MAP;
Expand Down Expand Up @@ -71,7 +77,14 @@ public void afterConnectionEstablished(WebSocketSession session) {
try {
startLogTailer(CommonUtils.LOG_FILE_PATH);
} catch (Exception e) {
log.error("启动日志监听服务失败:{}", e.getLocalizedMessage());
if (e.getLocalizedMessage().contains("Negative seek offset")) {
List<String> readUtf8Lines = FileUtil.readUtf8Lines(CommonUtils.LOG_FILE_PATH);
readUtf8Lines.add("\n");
FileUtil.writeUtf8Lines(new ArrayList<>(100), CommonUtils.LOG_FILE_PATH);
FileUtil.writeUtf8Lines(readUtf8Lines, CommonUtils.LOG_FILE_PATH);
} else {
log.error("启动日志监听服务失败:{}", e.getLocalizedMessage());
}
}

sendRecentLogs();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/resources/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>oci-helper</title><script defer="defer" src="/js/chunk-vendors.7b3b6355.js"></script><script defer="defer" src="/js/app.d45e6831.js"></script><link href="/css/chunk-vendors.4bfb3d11.css" rel="stylesheet"><link href="/css/app.7c722894.css" rel="stylesheet"></head><body><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>oci-helper</title><script defer="defer" src="/js/chunk-vendors.03985d9a.js"></script><script defer="defer" src="/js/app.beb50e95.js"></script><link href="/css/chunk-vendors.4bfb3d11.css" rel="stylesheet"><link href="/css/app.0f7d94aa.css" rel="stylesheet"></head><body><div id="app"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 7ce9037

Please sign in to comment.