As an experienced CMS website operation personnel of an enterprise, I know the importance of stable operation of the website for content publication and user experience.In daily work, log files are an indispensable tool for diagnosing system health and quickly locating problems.running.logandcheck.logThese two critical log files, each recording different process information, together provide us with valuable clues for troubleshooting system failures.

AnQiCMS process information is inrunning.logandcheck.logThe record in Chinese

When the AnQiCMS system runs on the server, in order to ensure its stability and maintainability, the system will automatically generate and updaterunning.logandcheck.logThese two log files. They each have different responsibilities, recording information at different levels of the process.

check.logThe file mainly records the health check status of the AnQiCMS application process. According to the design of the AnQiCMS startup script, there is usually a scheduled task (such ascrontabRun a check script at regular intervals.This script's core task is to confirm whether the main process of AnQiCMS is running.If the process does not exist, it will try to restart AnQiCMS.check.logThe information recorded, which is the result of these periodic checks, including the timestamp of the check, the name of the AnQiCMS executable file, and whether the system detected the existence of the AnQiCMS process at the time of execution. For example, the log may appearPID check: 0Indicates that the process is not running, orPID check: 1The process is running.This allows us to clearly understand whether the lifecycle management of the AnQiCMS process is normal, whether there is a startup script continuously trying to start the service, and whether these attempts are successful.

running.logThe file records the actual running status of the AnQiCMS main application in more detail. When we go throughnohupWhen the AnQiCMS main program is started, all standard output (stdout) and standard error (stderr) will be redirected and recorded torunning.logHello.This means, any information during the execution of the application, including initialization messages at system startup, normal business operation logs, warning information, and more critical program errors (such as Go language panic stack information), database connection issues, configuration loading failures, routing handling exceptions, etc., will be meticulously recorded in this file.It is the direct manifestation of the internal behavior of the AnQiCMS application, reflecting the problems encountered by the program during runtime or the operations being performed.

How to utilizerunning.logandcheck.logTracing the fault

When an exception occurs on the AnQiCMS website, these two log files are powerful assistants for system troubleshooting.Understanding the content recorded by each and analyzing it in conjunction with actual circumstances can help us quickly locate the root cause.

Firstly, fromcheck.logStart to judge the process management problem.When the website is inaccessible, we should prioritize checking.check.log. By checking the latest log entries, we can determine if the AnQiCMS startup script is running normally. Ifcheck.logThere has been no new record for a long time, or the process is continuously displayed (PID check: 0This may mean that AnQiCMS has not started successfully, or there is a problem with the startup script itself. At this point, we need to checkcrontabwhether the configuration is correct, and the startup scriptstart.shWhether the permissions are sufficient, and whether the internal path configuration is consistent with the actual installation path of AnQiCMS. A common scenario is, ifcheck.logThe script repeatedly attempts to start but the process always fails to maintain, then the problem may be with the AnQiCMS application itself, butcheck.logTell us at least that the "custodian" mechanism at the process management level exists.

Secondly, analyze in depth.running.logLocate internal errors of the application.Ifcheck.logDisplay the AnQiCMS process is started normally, but the website still cannot be accessed, or there are abnormal functions, then the problem is very likely to be in the AnQiCMS application itself. At this time,running.logIt became our most important clue. We should usetail -f running.logCommand to view the latest log content in real time, or backtrack historical logs. Inrunning.logFocus on the following types of information:

  • Error message (Error) and warning message (Warning)These are usually indicated by a specific prefix or color, and are issues reported by the application itself.They may point to configuration errors, database connection failures, timeouts on external service calls, insufficient file permissions, and so on.
  • Stack trace of Go language PanicIf the AnQiCMS application encounters an uncaught severe error (panic in Go language),running.logIt will record the complete stack trace information. This is the key to locating the cause of program crashes, which usually points out the code file and line number causing the crash.
  • Database-related logs: AnQiCMS needs to connect to the database to work properly.running.logMay log database connection failures, SQL execution errors, or slow queries. These are common performance bottlenecks or configuration issues.
  • Port binding conflict: If AnQiCMS tries to listen on a port (default 8001) that is already in use by another program,running.logerror information related to port binding will be recorded. Combinelsof -i:{端口号}The command can further confirm the port occupancy situation.
  • Detailed output in the startup phase.: AnQiCMS prints a series of initialization information during startup, including loading configuration, initializing modules, registering routes, etc. If the program fails at any stage of startup,running.logIt will stop at the last normal log before failure, or directly output the error message.

Combine both to form a complete troubleshooting path.For example, when the website is inaccessible:

  1. Checkcheck.log:Confirm whether the startup script is running AnQiCMS.
    • Ifcheck.logNo updates or the process is always not started: Checkstart.shScript path, permissions andcrontabTask. The issue may be at the system level or in the process management script.
    • Ifcheck.logThe process has started: proceed to the next step, the issue may be at the application level.
  2. Checkrunning.logCheck the actual running status of the application.
    • Ifrunning.logThere are recently updated error messages (such as database connection failure, configuration loading error, port conflict, Go panic): correct the corresponding configuration file, database service, or release the port according to the error prompts.
    • Ifrunning.logThe content is scarce or not updated, butcheck.logThe process has started: this may mean that the application crashed immediately after starting, without having time to output much log, or there is a problem with the log file write permission. At this time, you can try to execute manuallystart.shof the AnQiCMS startup command, observe the terminal output, or checkrunning.logfile permissions.

By the above method, we can make good use of it systematicallyrunning.logandcheck.logThese log files, from process management to the internal application, deeply analyze and solve various problems encountered during the operation of AnQiCMS, ensuring the continuous stable operation of the website.


Frequently Asked Questions (FAQ)

1. Q: AnQiCMS website suddenly stopped working, which log file should I check first?

A: When the AnQiCMS website is inaccessible, you should first checkcheck.logthe file. This file records the periodic health check results of the AnQiCMS process. Ifcheck.logThe AnQiCMS process is not running, or the startup script keeps trying to start repeatedly, then the problem may be at the process management level. Ifcheck.logDisplay the process started normally, but the website still cannot be accessed, so the next step is to checkrunning.logto locate the internal errors of the application.

2. Q:running.logWhat does it mean when "address already in use" error is displayed? How can I solve it?

A:running.logAn "address already in use" error means that AnQiCMS is trying to listen on a port (usually 8001) that is already being used by another program on the server. Solutions to this problem include: first, you can uselsof -i:{端口号}for examplelsof -i:8001)Command to find and terminate the process occupying the port on the Linux system. Moreover, you can also modify the AnQiCMS configuration file(config.json),toportChange the parameter to another unused port on the server and then restart the AnQiCMS service.

3. Q:check.logWhy has there been no update for a long time, or why has the PID detection result inside always been the same?

A:check.logThe system has not been updated for a long time, or the PID detection result is abnormal, which usually indicates that the AnQiCMS health check is being executed.start.shThe script was not executed correctly. This may be due to the following reasons:

  • The crontab task is not configured or configured incorrectly: Check the server'scrontab -eSet, ensure that a task is running every minutestart.shThe script task is correct, and the path is correct.
  • start.shThe script file has insufficient permissions: Make surestart.shThe file has executable permissions (chmod +x start.sh)
  • start.shThe script path is incorrect or dependencies are missingCheck what is defined in the scriptBINPATHandBINNAMEIs it consistent with the actual installation path and executable file name of AnQiCMS.If the script encounters a syntax error or dependency problem during execution, it may also cause it to fail to write logs normally../start.shObserve if there are any error outputs, and check if the log file has been updated to locate the specific problem.