radondb / xenon

The MySQL Cluster Autopilot Management with GTID and Raft
GNU General Public License v3.0
696 stars 162 forks source link

[feature] improve xenon xlog module #113

Closed hustjieke closed 3 years ago

hustjieke commented 3 years ago

Currently the log in xenon output without filename:

 2021/03/08 06:15:46.028670 [INFO]      main: tag=[v1.1.4-1-g63fd6c2], git=[63fd6c2], goversion=[go1.14.4], builddate=[2021/03/08 06:15:00]
 2021/03/08 06:15:46.028749 [WARNING]   xenon.conf.raft:[&{MetaDatadir:raft.meta HeartbeatTimeout:1000 AdmitDefeatHtCnt:10 ElectionTimeout:3000 PurgeBinlogInterval:300000 SuperIDLE:false LeaderStartCommand: LeaderStopCommand: PurgeBinlogDisabled:false RequestTimeout:500 CandidateWaitFor2Nodes:60000}]
 2021/03/08 06:15:46.028774 [WARNING]   xenon.conf.mysql:[&{Admin:root Passwd: Host:192.168.0.9 Port:3306 Basedir:/home/ubuntu/percona-server/xpkg1/install Version:mysql57 DefaultsFile:/home/ubuntu/percona-server/xpkg1/install/bin/my3306.cnf PingTimeout:1000 AdmitDefeatPingCnt:2 MasterSysVars: SlaveSysVars: ReplHost:192.168.0.2 ReplUser:qc_repl ReplPasswd:repl}]
 2021/03/08 06:15:46.028804 [WARNING]   xenon.conf.mysqld:[&{SSHHost:192.168.0.9 SSHUser:ubuntu SSHPasswd:ubuntu SSHPort:22 BackupDir:/home/ubuntu/data3306 XtrabackupBinDir:/home/ubuntu/percona-server/xpkg1/install BackupIOPSLimits:100000 UseMemory:2GB Parallel:2 MysqldMonitorInterval:1000 MaxAllowedLocalTrxCount:0 Admin:root Passwd: Host:192.168.0.9 Port:3306 Basedir:/home/ubuntu/percona-server/xpkg1/install DefaultsFile:/home/ubuntu/percona-server/xpkg1/install/bin/my3306.cnf}]

We should add file info, add log.Lshortfile into code like:

const (
        D_LOG_FLAGS int = log.LstdFlags | log.Lmicroseconds
)

changed to

const (
        D_LOG_FLAGS int = log.LstdFlags | log.Lmicroseconds | log.Lshortfile
)