mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 22:11:29 +00:00
Merge pull request #3818 from dbt4516/develop
Get the real location of the log directory before using filepath.Walk function when remove old logs
This commit is contained in:
commit
96658121dc
@ -359,6 +359,10 @@ RESTART_LOGGER:
|
|||||||
|
|
||||||
func (w *fileLogWriter) deleteOldLog() {
|
func (w *fileLogWriter) deleteOldLog() {
|
||||||
dir := filepath.Dir(w.Filename)
|
dir := filepath.Dir(w.Filename)
|
||||||
|
absolutePath, err := filepath.EvalSymlinks(w.Filename)
|
||||||
|
if err == nil {
|
||||||
|
dir = filepath.Dir(absolutePath)
|
||||||
|
}
|
||||||
filepath.Walk(dir, func(path string, info os.FileInfo, err error) (returnErr error) {
|
filepath.Walk(dir, func(path string, info os.FileInfo, err error) (returnErr error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user