Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix log print #299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions helper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func MarshalTOMLConfig() error {
CONFIG.Region = c.Region
CONFIG.Plugins = c.Plugins
CONFIG.PiggybackUpdateUsage = c.PiggybackUpdateUsage
CONFIG.LogPath = logFilePathWithPid(c.LogPath)
CONFIG.AccessLogPath = logFilePathWithPid(c.AccessLogPath)
CONFIG.LogPath = c.LogPath
CONFIG.AccessLogPath = c.AccessLogPath
CONFIG.AccessLogFormat = c.AccessLogFormat
CONFIG.PanicLogPath = c.PanicLogPath
CONFIG.PidFile = c.PidFile
Expand Down Expand Up @@ -181,4 +181,4 @@ func logFilePathWithPid(rawPath string) string {
parts := strings.Split(rawPath, "/")
parts[len(parts)-1] = fmt.Sprintf("%d.%s", pid, parts[len(parts)-1])
return strings.Join(parts, "/")
}
}
2 changes: 1 addition & 1 deletion package/access.logrotate
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
compress
/var/log/yig/*.access.log {
/var/log/yig/access.log {
daily
rotate 7
missingok
Expand Down
2 changes: 1 addition & 1 deletion package/yig.logrotate
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
compress
/var/log/yig/*.yig.log {
/var/log/yig/yig.log {
daily
rotate 7
missingok
Expand Down
13 changes: 7 additions & 6 deletions storage/backend_ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package storage
import (
"crypto/md5"
"encoding/hex"
"io"
"sync"
"time"

"github.com/journeymidnight/yig/api/datatype"
"github.com/journeymidnight/yig/backend"
"github.com/journeymidnight/yig/ceph"
Expand All @@ -14,9 +18,6 @@ import (
"github.com/journeymidnight/yig/meta/types"
"github.com/journeymidnight/yig/redis"
"github.com/journeymidnight/yig/signature"
"io"
"sync"
"time"
)

func New(metaCacheType int, enableDataCache bool, kms crypto.KMS) *YigStorage {
Expand Down Expand Up @@ -75,7 +76,7 @@ func (yig *YigStorage) AppendObject(bucketName string, objectName string, creden
initializationVector = objInfo.InitializationVector
objSize = objInfo.Size
storageClass = objInfo.StorageClass
helper.Logger.Println(20, "request append oid:", oid, "iv:", initializationVector, "size:", objSize)
helper.Logger.Info("request append oid:", oid, "iv:", initializationVector, "size:", objSize)
} else {
// New appendable object
cephCluster, poolName = yig.pickClusterAndPool(bucketName, objectName, storageClass, size, true)
Expand All @@ -89,7 +90,7 @@ func (yig *YigStorage) AppendObject(bucketName string, objectName string, creden
return
}
}
helper.Logger.Println(20, "request first append oid:", oid, "iv:", initializationVector, "size:", objSize)
helper.Logger.Info("request first append oid:", oid, "iv:", initializationVector, "size:", objSize)
}

dataReader := io.TeeReader(limitedDataReader, md5Writer)
Expand Down Expand Up @@ -149,7 +150,7 @@ func (yig *YigStorage) AppendObject(bucketName string, objectName string, creden

result.LastModified = object.LastModifiedTime
result.NextPosition = object.Size
helper.Logger.Println(20, "Append info.", "bucket:", bucketName, "objName:", objectName, "oid:", oid,
helper.Logger.Info("Append info.", "bucket:", bucketName, "objName:", objectName, "oid:", oid,
"objSize:", object.Size, "bytesWritten:", bytesWritten, "storageClass:", storageClass)
err = yig.MetaStorage.AppendObject(object, objInfo != nil)
if err != nil {
Expand Down