diff --git a/.gitignore b/.gitignore index a6482a3..657294b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ go.work # Lithium specific -settings.json \ No newline at end of file +settings.json +lithium.log \ No newline at end of file diff --git a/main.go b/main.go index c09ad75..60d016e 100644 --- a/main.go +++ b/main.go @@ -149,8 +149,15 @@ func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvi } func main() { + logFile, err := os.OpenFile("lithium.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) + if err == nil { + multiWriter := io.MultiWriter(os.Stdout, logFile) + logrus.SetOutput(multiWriter) + } else { + logrus.SetOutput(os.Stdout) + } + logrus.SetFormatter(&logrus.JSONFormatter{}) - logrus.SetOutput(os.Stdout) appSettings, err := settings.LoadSettings(afero.NewOsFs()) if err != nil {