mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-27 17:26:03 +08:00
fix(database): Fix missing database logs (#8145)
This commit is contained in:
parent
c2dc38f02f
commit
4ff06401d9
4 changed files with 13 additions and 20 deletions
|
|
@ -892,21 +892,13 @@ func collectLogs(params dto.StreamLog, messageChan chan<- string, errorChan chan
|
|||
errorChan <- fmt.Errorf("failed to get stdout pipe: %v", err)
|
||||
return
|
||||
}
|
||||
stderr, err := dockerCmd.StderrPipe()
|
||||
if err != nil {
|
||||
errorChan <- fmt.Errorf("failed to get stderr pipe: %v", err)
|
||||
return
|
||||
}
|
||||
dockerCmd.Stderr = dockerCmd.Stdout
|
||||
if err = dockerCmd.Start(); err != nil {
|
||||
errorChan <- fmt.Errorf("failed to start command: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
scanner := bufio.NewScanner(stdout)
|
||||
lineNumber := 0
|
||||
|
||||
for scanner.Scan() {
|
||||
lineNumber++
|
||||
message := scanner.Text()
|
||||
select {
|
||||
case messageChan <- message:
|
||||
|
|
@ -915,17 +907,10 @@ func collectLogs(params dto.StreamLog, messageChan chan<- string, errorChan chan
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err = scanner.Err(); err != nil {
|
||||
errorChan <- fmt.Errorf("scanner error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
errScanner := bufio.NewScanner(stderr)
|
||||
for errScanner.Scan() {
|
||||
line := errScanner.Text()
|
||||
errorChan <- fmt.Errorf("%v", line)
|
||||
}
|
||||
if err = dockerCmd.Wait(); err != nil {
|
||||
errorChan <- fmt.Errorf("%v", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
{{ $t('commons.button.clean') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="log-container" ref="logContainer">
|
||||
<div class="log-container" :style="styleVars" ref="logContainer">
|
||||
<div class="log-spacer" :style="{ height: `${totalHeight}px` }"></div>
|
||||
<div
|
||||
v-for="(log, index) in visibleLogs"
|
||||
|
|
@ -61,8 +61,16 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
highlightDiff: {
|
||||
type: Number,
|
||||
default: 320,
|
||||
},
|
||||
});
|
||||
|
||||
const styleVars = computed(() => ({
|
||||
'--custom-height': `${props.highlightDiff || 320}px`,
|
||||
}));
|
||||
|
||||
const logVisible = ref(false);
|
||||
const logContainer = ref<HTMLElement | null>(null);
|
||||
const logs = ref<string[]>([]);
|
||||
|
|
@ -252,7 +260,7 @@ onMounted(() => {
|
|||
}
|
||||
|
||||
.log-container {
|
||||
height: calc(100vh - 350px);
|
||||
height: calc(100vh - var(--custom-height, 320px));
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<ContainerLog v-if="activeName === 'log'" :container="baseInfo.containerID" />
|
||||
<ContainerLog v-if="activeName === 'log'" :container="baseInfo.containerID" :highlightDiff="350" />
|
||||
<SlowLog
|
||||
@loading="changeLoading"
|
||||
@refresh="loadBaseInfo"
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<ContainerLog v-if="activeName === 'log'" :container="containerID" />
|
||||
<ContainerLog v-if="activeName === 'log'" :container="containerID" :highlightDiff="350" />
|
||||
</template>
|
||||
</LayoutContent>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue