Added LDAP log for users without idsC2Profile.
Change-Id: Ie5256979b7da10eef4092ecc03edc8eabc57c24d
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java b/full/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
index a597f62..15b1b56 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/LdapAuth3.java
@@ -15,6 +15,8 @@
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.text.StringSubstitutor;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import com.unboundid.ldap.sdk.BindResult;
import com.unboundid.ldap.sdk.Filter;
@@ -50,6 +52,7 @@
public static final int LDAP_AUTH_RNAUTH = 7; // User Account or Pwd unknown, or not authorized
final static Boolean DEBUGLOG = false; // log debug output.
+ private static Logger jlog = LogManager.getLogger(LdapAuth3.class);
public static String getErrMessage(int code) {
switch (code) {
@@ -279,6 +282,7 @@
username = entry.getAttributeValue(idsC2Attribute);
if (username == null) {
username = entry.getAttributeValue(uidAttribute);
+ jlog.warn("idsC2Profile not found for uid: "+username);
}
}
return username;
diff --git a/full/src/main/resources/log4j2.properties b/full/src/main/resources/log4j2.properties
index c366776..76fd08f 100644
--- a/full/src/main/resources/log4j2.properties
+++ b/full/src/main/resources/log4j2.properties
@@ -1,3 +1,4 @@
+#appenders = console, mainFile, ldapFile
appenders = console, mainFile
appender.console.type = Console
appender.console.name = STDOUT
@@ -10,6 +11,13 @@
appender.mainFile.layout.type=PatternLayout
appender.mainFile.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=./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
rootLogger.appenderRefs = console,mainFile
rootLogger.appenderRef.file.ref = MAINLOG
@@ -27,4 +35,11 @@
logger.console.level = warn
logger.console.appenderRefs = file
logger.console.appenderRef.file.ref = MAINLOG
-logger.console.additivity=false
\ No newline at end of file
+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
diff --git a/full/src/test/resources/log4j2-test.properties b/full/src/test/resources/log4j2-test.properties
index 872b150..50d78e7 100644
--- a/full/src/test/resources/log4j2-test.properties
+++ b/full/src/test/resources/log4j2-test.properties
@@ -1,4 +1,4 @@
-appenders = console
+appenders = console,ldapFile
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
@@ -10,6 +10,12 @@
#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=./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 = error
rootLogger.appenderRefs = console
rootLogger.appenderRef.stdout.ref = STDOUT
@@ -41,3 +47,10 @@
logger.console.appenderRefs = stdout
logger.console.appenderRef.file.ref = STDOUT
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