fixing log not writing to file
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
ServerPort = ":8000" #leave format as is it expects a string with colon
|
||||
ServerAddr = "192.168.1.6" #Put in the IP address you want to bind to
|
||||
LogLevel = "Info" # Options = Debug, Info, Warn, Error, Fatal, Panic
|
||||
LogOutput = "stdout" #Options = file, stdout #file will print it to logs/server.log
|
||||
LogLevel = "Debug" # Options = Debug, Info, Warn, Error, Fatal, Panic
|
||||
LogOutput = "file" #Options = file, stdout #file will print it to logs/server.log
|
||||
|
||||
SeedRatioStop = 1.50 #automatically stops the torrent after it reaches this seeding ratio
|
||||
|
||||
|
@@ -280,8 +280,11 @@ func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto
|
||||
Storage.UpdateStorageTick(db, tStorage)
|
||||
go func() { //moving torrent in separate go-routine then verifying that the data is still there and correct
|
||||
err := MoveAndLeaveSymlink(config, singleTorrent.InfoHash().String(), db, false, "") //can take some time to move file so running this in another thread TODO make this a goroutine and skip this block if the routine is still running
|
||||
if err != nil {
|
||||
if err != nil { //If we fail, print the error and attempt a retry
|
||||
Logger.WithFields(logrus.Fields{"singleTorrent": singleTorrentFromStorage.TorrentName, "error": err}).Info("Failed to move Torrent!")
|
||||
VerifyData(singleTorrent)
|
||||
tStorage.TorrentMoved = false
|
||||
Storage.UpdateStorageTick(db, tStorage)
|
||||
}
|
||||
}()
|
||||
|
||||
|
19
main.go
19
main.go
@@ -103,16 +103,17 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println("Unable to create 'log' folder for logging.... please check permissions.. forcing output to stdout", err)
|
||||
Logger.Out = os.Stdout
|
||||
} else {
|
||||
os.Remove("logs/server.log") //cleanup the old log on every restart
|
||||
file, err := os.OpenFile("logs/server.log", os.O_CREATE|os.O_WRONLY, 0755) //creating the log file
|
||||
defer file.Close() //TODO.. since we write to this constantly how does close work?
|
||||
if err != nil {
|
||||
fmt.Println("Unable to create file for logging.... please check permissions.. forcing output to stdout")
|
||||
Logger.Out = os.Stdout
|
||||
}
|
||||
Logger.Out = file
|
||||
}
|
||||
} else {
|
||||
os.Remove("logs/server.log") //cleanup the old log on every restart
|
||||
file, err := os.OpenFile("logs/server.log", os.O_CREATE|os.O_WRONLY, 0755) //creating the log file
|
||||
//defer file.Close() //TODO.. since we write to this constantly how does close work?
|
||||
if err != nil {
|
||||
fmt.Println("Unable to create file for logging.... please check permissions.. forcing output to stdout")
|
||||
Logger.Out = os.Stdout
|
||||
}
|
||||
fmt.Println("Logging to file logs/server.log")
|
||||
Logger.Out = file
|
||||
}
|
||||
} else {
|
||||
Logger.Out = os.Stdout
|
||||
|
Reference in New Issue
Block a user