Adding structuredLogging check and fix inconsistencies (#13370)
* Adding structuredLogging check and fix inconsistencies * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments * Addressing PR review comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fd0a3a687d
Коммит
b8ef62e502
@@ -4,7 +4,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -272,7 +271,7 @@ func (a *App) tryExecuteCustomCommand(args *model.CommandArgs, trigger string, m
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
mlog.Debug(fmt.Sprintf(utils.T("api.command.execute_command.debug"), trigger, args.UserId))
|
||||
mlog.Debug("Executing command", mlog.String("command", trigger), mlog.String("user_id", args.UserId))
|
||||
|
||||
p := url.Values{}
|
||||
p.Set("token", cmd.Token)
|
||||
|
||||
@@ -71,7 +71,7 @@ func NewEmailBatchingJob(s *Server, bufferSize int) *EmailBatchingJob {
|
||||
}
|
||||
|
||||
func (job *EmailBatchingJob) Start() {
|
||||
mlog.Debug(fmt.Sprintf("Email batching job starting. Checking for pending emails every %v seconds.", *job.server.Config().EmailSettings.EmailBatchingInterval))
|
||||
mlog.Debug("Email batching job starting. Checking for pending emails periodically.", mlog.Int("interval_in_seconds", *job.server.Config().EmailSettings.EmailBatchingInterval))
|
||||
newTask := model.CreateRecurringTask(EMAIL_BATCHING_TASK_NAME, job.CheckPendingEmails, time.Duration(*job.server.Config().EmailSettings.EmailBatchingInterval)*time.Second)
|
||||
|
||||
job.taskMutex.Lock()
|
||||
@@ -107,7 +107,7 @@ func (job *EmailBatchingJob) CheckPendingEmails() {
|
||||
// without actually sending emails
|
||||
job.checkPendingNotifications(time.Now(), job.server.sendBatchedEmailNotification)
|
||||
|
||||
mlog.Debug(fmt.Sprintf("Email batching job ran. %v user(s) still have notifications pending.", len(job.pendingNotifications)))
|
||||
mlog.Debug("Email batching job ran. Some users still have notifications pending.", mlog.Int("number_of_users", len(job.pendingNotifications)))
|
||||
}
|
||||
|
||||
func (job *EmailBatchingJob) handleNewNotifications() {
|
||||
|
||||
@@ -145,10 +145,11 @@ func (a *App) getInfoForFilename(post *model.Post, teamId, channelId, userId, ol
|
||||
data, err := a.ReadFile(path)
|
||||
if err != nil {
|
||||
mlog.Error(
|
||||
fmt.Sprintf("File not found when migrating post to use FileInfos, err=%v", err),
|
||||
"File not found when migrating post to use FileInfos",
|
||||
mlog.String("post_id", post.Id),
|
||||
mlog.String("filename", filename),
|
||||
mlog.String("path", path),
|
||||
mlog.Err(err),
|
||||
)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
@@ -19,7 +18,7 @@ func (a *App) SyncLdap() {
|
||||
if ldapI := a.Ldap; ldapI != nil {
|
||||
ldapI.StartSynchronizeJob(false)
|
||||
} else {
|
||||
mlog.Error(fmt.Sprintf("%v", model.NewAppError("SyncLdap", "ent.ldap.disabled.app_error", nil, "", http.StatusNotImplemented).Error()))
|
||||
mlog.Error("Not executing ldap sync because ldap is not available")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -215,8 +215,20 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
}
|
||||
})
|
||||
|
||||
mlog.Info(fmt.Sprintf("Current version is %v (%v/%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise))
|
||||
mlog.Info(fmt.Sprintf("Enterprise Enabled: %v", model.BuildEnterpriseReady))
|
||||
logCurrentVersion := fmt.Sprintf("Current version is %v (%v/%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise)
|
||||
mlog.Info(
|
||||
logCurrentVersion,
|
||||
mlog.String("current_version", model.CurrentVersion),
|
||||
mlog.String("build_number", model.BuildNumber),
|
||||
mlog.String("build_date", model.BuildDate),
|
||||
mlog.String("build_hash", model.BuildHash),
|
||||
mlog.String("build_hash_enterprise", model.BuildHashEnterprise),
|
||||
)
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
mlog.Info("Enterprise Build", mlog.Bool("enterprise_build", true))
|
||||
} else {
|
||||
mlog.Info("Team Edition Build", mlog.Bool("enterprise_build", false))
|
||||
}
|
||||
|
||||
pwd, _ := os.Getwd()
|
||||
mlog.Info("Printing current working", mlog.String("directory", pwd))
|
||||
@@ -505,7 +517,8 @@ func (s *Server) Start() error {
|
||||
}
|
||||
s.ListenAddr = listener.Addr().(*net.TCPAddr)
|
||||
|
||||
mlog.Info(fmt.Sprintf("Server is listening on %v", listener.Addr().String()))
|
||||
logListeningPort := fmt.Sprintf("Server is listening on %v", listener.Addr().String())
|
||||
mlog.Info(logListeningPort, mlog.String("address", listener.Addr().String()))
|
||||
|
||||
// Migration from old let's encrypt library
|
||||
if *s.Config().ServiceSettings.UseLetsEncrypt {
|
||||
|
||||
Ссылка в новой задаче
Block a user