Remove log mirroring

This commit is contained in:
Arthur Barr
2017-10-05 15:11:05 +01:00
parent 43ac1ec4ec
commit 18284a5580

View File

@@ -30,7 +30,6 @@ import (
"strings" "strings"
"syscall" "syscall"
"github.com/hpcloud/tail"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@@ -187,6 +186,7 @@ func updateCommandLevel() {
} }
func startQueueManager() { func startQueueManager() {
log.Println("Starting queue manager")
out, rc, err := runCommand("strmqm") out, rc, err := runCommand("strmqm")
if err != nil { if err != nil {
log.Fatalf("Error %v starting queue manager: %v", rc, string(out)) log.Fatalf("Error %v starting queue manager: %v", rc, string(out))
@@ -276,32 +276,32 @@ func createReaper() {
// mirrorLog tails the specified file, and logs each line. // mirrorLog tails the specified file, and logs each line.
// This is useful for usability, as the container console log can show // This is useful for usability, as the container console log can show
// messages from the MQ log. // messages from the MQ log.
func mirrorLog(path string) error { // func mirrorLog(path string) error {
tail, err := tail.TailFile(path, tail.Config{ // tail, err := tail.TailFile(path, tail.Config{
ReOpen: true, // ReOpen: true,
Follow: true, // Follow: true,
Poll: true, // Poll: true,
Location: &tail.SeekInfo{ // Location: &tail.SeekInfo{
Offset: 0, // Offset: 0,
// End of file // // End of file
Whence: 2, // Whence: 2,
}, // },
Logger: tail.DiscardingLogger, // Logger: tail.DiscardingLogger,
}) // })
if err != nil { // if err != nil {
return err // return err
} // }
go func() { // go func() {
for line := range tail.Lines { // for line := range tail.Lines {
// TODO: Unless we parse the message, the timestamp will be (slightly) wrong // // TODO: Unless we parse the message, the timestamp will be (slightly) wrong
if strings.HasPrefix(line.Text, "AMQ") { // if strings.HasPrefix(line.Text, "AMQ") {
// TODO: Extended characters don't print correctly // // TODO: Extended characters don't print correctly
log.Println(line.Text) // log.Println(line.Text)
} // }
} // }
}() // }()
return nil // return nil
} // }
func main() { func main() {
createReaper() createReaper()
@@ -321,7 +321,7 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
createDirStructure() createDirStructure()
mirrorLog("/var/mqm/qmgrs/" + name + "/errors/AMQERR01.LOG") //mirrorLog("/var/mqm/qmgrs/" + name + "/errors/AMQERR01.LOG")
createQueueManager(name) createQueueManager(name)
updateCommandLevel() updateCommandLevel()
startQueueManager() startQueueManager()