Fix some logging to write to file instead of stdout.
Change-Id: I3ea5449aee7d9683017cd03ab3e61d03c9b5bc82
diff --git a/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java b/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
index 845a6d5..03c4a5d 100644
--- a/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
+++ b/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
@@ -192,7 +192,10 @@
System.out.print("Binding: OK.\n");
}
catch (LDAPException e) {
- System.err.printf("Error: login: Binding failed: '%s'!\n", e);
+// System.err.printf("Error: login: Binding failed: '%s'!\n", e);
+ String error = String.format("Error: login: Binding failed: "
+ + "'%s'!\n", e);
+ jlog.error(error);
ldapTerminate(lc);
return new LdapAuth3Result(null, LDAP_AUTH_RINTERR);
}
@@ -246,7 +249,10 @@
}
}
catch (LDAPException e) {
- System.err.printf("Error: login: Binding failed: '%s'!\n", e);
+// System.err.printf("Error: login: Binding failed: '%s'!\n", e);
+ String error = String.format("Error: login: Binding failed: "
+ + "'%s'!\n", e);
+ jlog.error(error);
ldapTerminate(lc);
return new LdapAuth3Result(null, LDAP_AUTH_RUNKNOWN);
}
diff --git a/src/main/resources/log4j2.properties b/src/main/resources/log4j2.properties
index dabe381..1201846 100644
--- a/src/main/resources/log4j2.properties
+++ b/src/main/resources/log4j2.properties
@@ -1,5 +1,5 @@
-#appenders = console, file, ldapFile
-appenders = console, file
+appenders = console, file, ldapFile
+#appenders = console, file
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
@@ -11,11 +11,11 @@
appender.file.layout.type=PatternLayout
appender.file.layout.pattern= %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
-#appender.ldapFile.type = File
-#appender.ldapFile.name = LDAP_LOG
-#appender.ldapFile.fileName=./data/logs/ldap.log
-#appender.ldapFile.layout.type=PatternLayout
-#appender.ldapFile.layout.pattern= %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
+appender.ldapFile.type = File
+appender.ldapFile.name = LDAP_LOG
+appender.ldapFile.fileName=./data/logs/ldap.log
+appender.ldapFile.layout.type=PatternLayout
+appender.ldapFile.layout.pattern= %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
rootLogger.level = warn
@@ -23,23 +23,28 @@
rootLogger.appenderRef.file.ref = MAINLOG
rootLogger.additivity=true
-loggers=file
+loggers=file, auth, ldap
logger.file.name=de.ids_mannheim.korap
logger.file.level = info
logger.file.appenderRefs = file
logger.file.appenderRef.file.ref = MAINLOG
logger.file.additivity=false
-loggers=file
-logger.console.name=de.ids_mannheim.korap.web.controller.AuthenticationController
-logger.console.level = warn
-logger.console.appenderRefs = file
-logger.console.appenderRef.file.ref = MAINLOG
-logger.console.additivity=false
-
#loggers=file
-#logger.file.name=de.ids_mannheim.korap.authentication.LdapAuth3
-#logger.file.level = info
-#logger.file.appenderRefs = file
-#logger.file.appenderRef.file.ref = LDAP_LOG
-#logger.file.additivity=false
\ No newline at end of file
+#logger.console.name=de.ids_mannheim.korap.web.controller.AuthenticationController
+#logger.console.level = warn
+#logger.console.appenderRefs = file
+#logger.console.appenderRef.file.ref = MAINLOG
+#logger.console.additivity=false
+
+logger.auth.name=de.ids_mannheim.korap.authentication.KustvaktAuthenticationManager
+logger.auth.level = error
+logger.auth.appenderRefs = file
+logger.auth.appenderRef.file.ref = LDAP_LOG
+logger.auth.additivity=false
+
+logger.ldap.name=de.ids_mannheim.korap.authentication.LdapAuth3
+logger.ldap.level = info
+logger.ldap.appenderRefs = file
+logger.ldap.appenderRef.file.ref = LDAP_LOG
+logger.ldap.additivity=false
\ No newline at end of file