diff --git a/cmd/install_windows.go b/cmd/install_windows.go index c4511901..16268f35 100644 --- a/cmd/install_windows.go +++ b/cmd/install_windows.go @@ -31,6 +31,7 @@ Please take a look at the usage below to customize the startup options`, LogMaxAge: logMaxAge, LogCompress: logCompress, LogVerbose: logVerbose, + LogUTCTime: logUTCTime, Shutdown: make(chan bool), } winService := service.WindowsService{ @@ -87,6 +88,9 @@ func getCustomServeFlags() []string { if logVerbose != defaultLogVerbose { result = append(result, "--"+logVerboseFlag+"=false") } + if logUTCTime != defaultLogUTCTime { + result = append(result, "--"+logUTCTimeFlag+"=true") + } if logCompress != defaultLogCompress { result = append(result, "--"+logCompressFlag+"=true") } diff --git a/cmd/portable.go b/cmd/portable.go index 3bfd74ac..e28a9892 100644 --- a/cmd/portable.go +++ b/cmd/portable.go @@ -31,6 +31,7 @@ var ( portablePassword string portableLogFile string portableLogVerbose bool + portableLogUTCTime bool portablePublicKeys []string portablePermissions []string portableSSHCommands []string @@ -143,6 +144,7 @@ Please take a look at the usage below to customize the serving parameters`, LogMaxAge: defaultLogMaxAge, LogCompress: defaultLogCompress, LogVerbose: portableLogVerbose, + LogUTCTime: portableLogUTCTime, Shutdown: make(chan bool), PortableMode: 1, PortableUser: dataprovider.User{ @@ -251,6 +253,7 @@ value`) value`) portableCmd.Flags().StringVarP(&portableLogFile, logFilePathFlag, "l", "", "Leave empty to disable logging") portableCmd.Flags().BoolVarP(&portableLogVerbose, logVerboseFlag, "v", false, "Enable verbose logs") + portableCmd.Flags().BoolVar(&portableLogUTCTime, logUTCTimeFlag, false, "Use UTC time for logging") portableCmd.Flags().StringSliceVarP(&portablePublicKeys, "public-key", "k", []string{}, "") portableCmd.Flags().StringSliceVarP(&portablePermissions, "permissions", "g", []string{"list", "download"}, `User's permissions. "*" means any diff --git a/cmd/start_windows.go b/cmd/start_windows.go index 1096090d..2e10c340 100644 --- a/cmd/start_windows.go +++ b/cmd/start_windows.go @@ -29,6 +29,7 @@ var ( LogMaxAge: logMaxAge, LogCompress: logCompress, LogVerbose: logVerbose, + LogUTCTime: logUTCTime, Shutdown: make(chan bool), } winService := service.WindowsService{ diff --git a/docs/portable-mode.md b/docs/portable-mode.md index b1508650..1bc47f85 100644 --- a/docs/portable-mode.md +++ b/docs/portable-mode.md @@ -72,6 +72,7 @@ Flags: --gcs-storage-class string -h, --help help for portable -l, --log-file-path string Leave empty to disable logging + --log-utc-time Use UTC time for logging -v, --log-verbose Enable verbose logs -p, --password string Leave empty to use an auto generated value diff --git a/service/service.go b/service/service.go index ba1bfa00..0e222283 100644 --- a/service/service.go +++ b/service/service.go @@ -69,8 +69,8 @@ func (s *Service) initLogger() { func (s *Service) Start() error { s.initLogger() logger.Info(logSender, "", "starting SFTPGo %v, config dir: %v, config file: %v, log max size: %v log max backups: %v "+ - "log max age: %v log verbose: %v, log compress: %v, load data from: %#v", version.GetAsString(), s.ConfigDir, s.ConfigFile, - s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge, s.LogVerbose, s.LogCompress, s.LoadDataFrom) + "log max age: %v log verbose: %v, log compress: %v, log utc time: %v, load data from: %#v", version.GetAsString(), s.ConfigDir, s.ConfigFile, + s.LogMaxSize, s.LogMaxBackups, s.LogMaxAge, s.LogVerbose, s.LogCompress, s.LogUTCTime, s.LoadDataFrom) // in portable mode we don't read configuration from file if s.PortableMode != 1 { err := config.LoadConfig(s.ConfigDir, s.ConfigFile)