summaryrefslogtreecommitdiff
path: root/cmd/authelia
diff options
context:
space:
mode:
authorClément Michaud <clement.michaud34@gmail.com>2020-03-09 20:57:53 +0100
committerGitHub <noreply@github.com>2020-03-09 20:57:53 +0100
commitc429488738ae97b29794cf589d41c93037d3f7f2 (patch)
treefac4fb09db8d3054f3a540af52765d182e3b37fc /cmd/authelia
parent6af27cb3f957df1dad5bfeca34baa963d7318284 (diff)
[FEATURE] [BREAKING] Support writing logs in a file. (#686)
* [FEATURE] Support writing logs in a file. * Add documentation about logs file path. * Rename logs_level and logs_file_path into log_level and log_file_path. * Update BREAKING.md Fixes #338 Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
Diffstat (limited to 'cmd/authelia')
-rw-r--r--cmd/authelia/main.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/authelia/main.go b/cmd/authelia/main.go
index 5dd849458..2ed6592a8 100644
--- a/cmd/authelia/main.go
+++ b/cmd/authelia/main.go
@@ -29,10 +29,6 @@ func startServer() {
log.Fatal(errors.New("No config file path provided"))
}
- if os.Getenv("ENVIRONMENT") == "dev" {
- logging.Logger().Info("===> Authelia is running in development mode. <===")
- }
-
config, errs := configuration.Read(configPathFlag)
if len(errs) > 0 {
@@ -42,7 +38,11 @@ func startServer() {
panic(errors.New("Some errors have been reported"))
}
- switch config.LogsLevel {
+ if err := logging.InitializeLogger(config.LogFilePath); err != nil {
+ log.Fatalf("Cannot initialize logger: %v", err)
+ }
+
+ switch config.LogLevel {
case "info":
logging.Logger().Info("Logging severity set to info")
logging.SetLevel(logrus.InfoLevel)
@@ -56,6 +56,10 @@ func startServer() {
logging.SetLevel(logrus.TraceLevel)
}
+ if os.Getenv("ENVIRONMENT") == "dev" {
+ logging.Logger().Info("===> Authelia is running in development mode. <===")
+ }
+
var userProvider authentication.UserProvider
if config.AuthenticationBackend.File != nil {