diff --git a/icsconf/icsconf.go b/icsconf/icsconf.go index 645d321..8e974ce 100644 --- a/icsconf/icsconf.go +++ b/icsconf/icsconf.go @@ -50,8 +50,9 @@ type LogConfig struct { } type DelConfig struct { - DelDay int `xml:"day,attr"` - DelHour int `xml:"hour,attr"` + DelDay int `xml:"day,attr"` + DelHour int `xml:"hour,attr"` + Value bool `xml:"value,attr"` } type RotateConfig struct { diff --git a/icslog/icslog.go b/icslog/icslog.go index 62c0aa2..f4d03b9 100644 --- a/icslog/icslog.go +++ b/icslog/icslog.go @@ -242,6 +242,10 @@ func GetLogOutputID(str string) int { } func (s *IcsLog) DelLog() { + conf := icsconf.GetIcsConfig() + if !conf.LogConfig.DelConfig.Value { + return + } //var derr *icserror.IcsError = nil delLogCount := 0 @@ -276,9 +280,9 @@ func (s *IcsLog) DelLog() { 2. 현재 시간 - 삭제기간 3. 둘 시간 차이가 0 이상 나면 삭제대상 */ - logTime := strings.SplitN(file.Name(), "-", -1)[1] + logTime := strings.SplitN(file.Name(), ".", -1)[1] logYYYY, logMM, logDD = logTime[:4], logTime[4:6], logTime[6:8] - chgLogTime, perr := time.Parse("2006-01-02", fmt.Sprintf("%s-%s-%s", logYYYY, logMM, logDD)) + chgLogTime, perr := time.Parse("2006-01-02", fmt.Sprintf("%s%s%s", logYYYY, logMM, logDD)) if perr != nil { // s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr) // fmt.Printf("Log Time Parse error - %s", perr)