title: Why is the native Golang logger not logging when it's a global variable?
body: <p>I have some pretty simple code where I'm logging some error info to a file. </p>
  
  <pre><code>package main
  
  import (
      "log"
      "os"
  )
  
  var testLogger *log.Logger
  
  func init() {
      logFile, openErr1 := os.OpenFile("/home/doug/logs/test.log", os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
  
      if openErr1 != nil {
          log.Println("Uh oh! Could not open log file.")
      }
  
      defer logFile.Close()
  
      testLogger = log.New(logFile, "PREFIX", log.Lshortfile|log.Ldate|log.Ltime)
  }
  
  func main() {
      testLogger.Println("meep meep")
  }
  </code></pre>
  
  <p>However, whenever I open the file after running the program, it is always empty. What am I doing wrong?</p>