logging updates
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 9f1bdee..ba271f0 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -2,11 +2,11 @@
import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import lombok.Getter;
import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
@@ -39,7 +39,7 @@
KUSTVAKT_USER.put(Attributes.INSTITUTION, "IDS Mannheim");
}
- private static final Logger jlog = KustvaktLogger
+ private static final Logger jlog = LoggerFactory
.getLogger(KustvaktConfiguration.class);
private String indexDir;
private int port;
@@ -92,7 +92,6 @@
*/
protected Properties load(Properties properties)
throws MalformedURLException {
- properties.list(System.out);
maxhits = new Integer(properties.getProperty("maxhits", "50000"));
returnhits = new Integer(properties.getProperty("returnhits", "50000"));
indexDir = properties.getProperty("lucene.indexDir", "");
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java b/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
index b7ee677..e55cae1 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
@@ -1,7 +1,7 @@
package de.ids_mannheim.korap.handlers;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.RowMapper;
@@ -21,7 +21,7 @@
private static final int SMALL_MEDIUM_BATCH = 6;
private static final int MEDIUM_BATCH = 8;
private static final int LARGE_BATCH = 12;
- private Logger log = KustvaktLogger.getLogger(BatchBuilder.class);
+ private Logger log = LoggerFactory.getLogger(BatchBuilder.class);
private JdbcOperations operations;
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java b/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
index 69255f9..d6d57bf 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
@@ -7,8 +7,8 @@
import de.ids_mannheim.korap.resources.KustvaktResource;
import de.ids_mannheim.korap.resources.VirtualCollection;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@@ -26,7 +26,7 @@
public class CollectionDao
implements ResourceOperationIface<VirtualCollection> {
- private static Logger log = KustvaktLogger.getLogger(CollectionDao.class);
+ private static Logger log = LoggerFactory.getLogger(CollectionDao.class);
private BatchBuilder batchBuilder;
protected final NamedParameterJdbcTemplate jdbcTemplate;
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
index 10082b2..067abda 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
@@ -10,9 +10,9 @@
import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
import de.ids_mannheim.korap.user.*;
import de.ids_mannheim.korap.utils.BooleanUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.RowMapper;
@@ -36,7 +36,7 @@
*/
public class EntityDao implements EntityHandlerIface {
- private static Logger jlog = KustvaktLogger.getLogger(EntityDao.class);
+ private static Logger jlog = LoggerFactory.getLogger(EntityDao.class);
private NamedParameterJdbcTemplate jdbcTemplate;
public EntityDao(PersistenceClient client) {
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java b/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
index b593bce..9b10f96 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
@@ -9,7 +9,6 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.BooleanUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import edu.emory.mathcs.backport.java.util.Collections;
import org.slf4j.Logger;
@@ -30,8 +29,7 @@
*/
public class OAuthDb {
- private static final Logger errorLogger = LoggerFactory
- .getLogger(KustvaktLogger.ERROR_LOG);
+ private static final Logger jlog = LoggerFactory.getLogger(OAuthDb.class);
private NamedParameterJdbcTemplate jdbcTemplate;
public OAuthDb(PersistenceClient client) {
@@ -62,8 +60,7 @@
}
});
}catch (EmptyResultDataAccessException ex) {
- errorLogger.error("'{}' client found", clientid,
- ex.fillInStackTrace());
+ jlog.error("'{}' client found", clientid, ex.fillInStackTrace());
return null;
}
}
@@ -76,8 +73,7 @@
try {
return this.jdbcTemplate.update(sql, s) == 1;
}catch (DataAccessException e) {
- errorLogger
- .error("token could not be revoked", e.fillInStackTrace());
+ jlog.error("token could not be revoked", e.fillInStackTrace());
return false;
}
}
@@ -95,9 +91,8 @@
try {
this.jdbcTemplate.update(tokens, source);
}catch (DataAccessException e) {
- errorLogger
- .error("authorization could not be revoked for user '{}'",
- user.getUsername());
+ jlog.error("authorization could not be revoked for user '{}'",
+ user.getUsername());
return false;
}
//fixme: if int row not updated, false!!
@@ -123,9 +118,8 @@
return this.jdbcTemplate.update(sql, s) == 1;
}catch (DataAccessException e) {
e.printStackTrace();
- errorLogger
- .error("token '{}' could not be added for user '{}'", token,
- userid);
+ jlog.error("token '{}' could not be added for user '{}'", token,
+ userid);
return false;
}
}
@@ -141,10 +135,10 @@
try {
return this.jdbcTemplate.queryForObject(sql, s, String.class);
}catch (EmptyResultDataAccessException ex) {
- errorLogger.error("no token found for user '{}'", userid);
+ jlog.error("no token found for user '{}'", userid);
return null;
}catch (DataAccessException ex) {
- errorLogger.error("token retrieval failed for user '{}'", userid);
+ jlog.error("token retrieval failed for user '{}'", userid);
return null;
}
}
@@ -178,7 +172,7 @@
}
});
}catch (DataAccessException e) {
- errorLogger.error("Data access error", e);
+ jlog.error("Data access error", e);
return Collections.emptyList();
}
@@ -213,11 +207,11 @@
});
return context;
}catch (EmptyResultDataAccessException ee) {
- errorLogger.error("no context found for token '{}'", token);
+ jlog.error("no context found for token '{}'", token);
revokeToken(token);
throw new KustvaktException(StatusCodes.EXPIRED, "token", token);
}catch (DataAccessException e) {
- errorLogger.error("token context retrieval failed for '{}'", token);
+ jlog.error("token context retrieval failed for '{}'", token);
throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
"invalid token", token);
}
@@ -238,8 +232,7 @@
this.jdbcTemplate.update(sql, p);
}catch (DataAccessException e) {
e.printStackTrace();
- errorLogger
- .error("removing client '{}' failed", info.getClient_id());
+ jlog.error("removing client '{}' failed", info.getClient_id());
throw new dbException(new KustvaktException(user.getId(),
StatusCodes.ILLEGAL_ARGUMENT, "arguments given not valid",
info.toJSON()), StatusCodes.CLIENT_REMOVAL_FAILURE,
@@ -264,8 +257,7 @@
this.jdbcTemplate.update(sql, p);
}catch (DataAccessException e) {
e.printStackTrace();
- errorLogger.error("registering client '{}' failed",
- info.getClient_id());
+ jlog.error("registering client '{}' failed", info.getClient_id());
throw new dbException(new KustvaktException(user.getId(),
StatusCodes.ILLEGAL_ARGUMENT, "arguments given not valid",
info.toJSON()), StatusCodes.CLIENT_REGISTRATION_FAILURE,
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
index 53c89fc..0aeeaac 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
@@ -9,9 +9,9 @@
import de.ids_mannheim.korap.resources.ResourceFactory;
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.SqlBuilder;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -30,7 +30,7 @@
public class ResourceDao<T extends KustvaktResource>
implements ResourceOperationIface<T> {
- private static Logger log = KustvaktLogger.getLogger(ResourceDao.class);
+ private static Logger log = LoggerFactory.getLogger(ResourceDao.class);
protected final NamedParameterJdbcTemplate jdbcTemplate;
public ResourceDao(PersistenceClient client) {
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
index f341afe..47c3033 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
@@ -5,7 +5,6 @@
import de.ids_mannheim.korap.exceptions.StatusCodes;
import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import edu.emory.mathcs.backport.java.util.Collections;
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.binary.Base64;
@@ -16,6 +15,7 @@
import org.owasp.esapi.errors.ValidationException;
import org.owasp.esapi.reference.DefaultValidator;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
@@ -31,7 +31,7 @@
public class KustvaktEncryption implements EncryptionIface {
private static final String ALGORITHM = "SHA-256";
- private static Logger jlog = KustvaktLogger
+ private static Logger jlog = LoggerFactory
.getLogger(KustvaktEncryption.class);
// todo: disable this
private static final String PASSWORD_SALT_FIELD = "accountCreation";
@@ -368,17 +368,17 @@
public String validatePassphrase(String pw) throws KustvaktException {
String safe_string = validateString(pw);
return safe_string;
-// String pw_conf;
-// try {
-// pw_conf = validator
-// .getValidInput("User Password", safe_string, "Password", 20,
-// false);
-// }catch (ValidationException e) {
-// jlog.error("password value did not validate", e.getMessage());
-// throw new KustvaktException(StatusCodes.PARAMETER_VALIDATION_ERROR,
-// "password did not validate", "password");
-// }
-// return pw_conf;
+ // String pw_conf;
+ // try {
+ // pw_conf = validator
+ // .getValidInput("User Password", safe_string, "Password", 20,
+ // false);
+ // }catch (ValidationException e) {
+ // jlog.error("password value did not validate", e.getMessage());
+ // throw new KustvaktException(StatusCodes.PARAMETER_VALIDATION_ERROR,
+ // "password did not validate", "password");
+ // }
+ // return pw_conf;
}
//FIXME: currently all sets are skipped during validation (since users should not be allowed to edit those sets anyway,
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
index 7123ef6..4db050a 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
@@ -4,8 +4,8 @@
import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -19,7 +19,7 @@
//todo: load rewritenode and rewritequery automatically from classpath by default, but namespaced from package
public class RewriteHandler {
- private static Logger jlog = KustvaktLogger.getLogger(RewriteHandler.class);
+ private static Logger jlog = LoggerFactory.getLogger(RewriteHandler.class);
private Collection<RewriteTask.IterableRewriteAt> node_processors;
private Collection<RewriteTask.RewriteKoralToken> token_node_processors;
private Collection<RewriteTask> query_processors;
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java b/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
index 1e8dafc..c239f99 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
@@ -9,7 +9,6 @@
import de.ids_mannheim.korap.resources.Permissions;
import de.ids_mannheim.korap.security.PolicyCondition;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,10 +20,8 @@
*/
public class ConditionManagement {
- private static final Logger errorLogger = LoggerFactory
- .getLogger(KustvaktLogger.ERROR_LOG);
- private static final Logger secErrorLogger = LoggerFactory
- .getLogger(KustvaktLogger.SECURITY_LOG);
+ private static final Logger jlog = LoggerFactory
+ .getLogger(ConditionManagement.class);
private User user;
private PolicyHandlerIface policydao;
@@ -50,7 +47,7 @@
== 1) {
policydao.addToCondition(usernames, condition, admin);
}else
- secErrorLogger.error("Users could not be added to condition '{}'",
+ jlog.error("Users could not be added to condition '{}'",
condition.getSpecifier());
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
index ec611e7..378f087 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
@@ -13,10 +13,10 @@
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.BooleanUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.StringUtils;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowCallbackHandler;
@@ -38,8 +38,7 @@
// todo: transactions and exception management
public class PolicyDao implements PolicyHandlerIface {
- private static final Logger jlog = KustvaktLogger
- .getLogger(PolicyDao.class);
+ private static final Logger jlog = LoggerFactory.getLogger(PolicyDao.class);
private NamedParameterJdbcTemplate jdbcTemplate;
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
index 745ef1f..4e6508a 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
@@ -8,9 +8,9 @@
import de.ids_mannheim.korap.security.SecurityPolicy;
import de.ids_mannheim.korap.user.KorAPUser;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import edu.emory.mathcs.backport.java.util.Collections;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
@@ -21,7 +21,7 @@
*/
public class PolicyEvaluator {
- private static final Logger jlog = KustvaktLogger
+ private static final Logger jlog = LoggerFactory
.getLogger(PolicyEvaluator.class);
private final User user;
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
index d2607cc..53e1706 100755
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
@@ -8,8 +8,8 @@
import de.ids_mannheim.korap.resources.ResourceFactory;
import de.ids_mannheim.korap.security.PermissionsBuffer;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.*;
@@ -18,7 +18,7 @@
*/
public class ResourceFinder {
- private static final Logger log = KustvaktLogger
+ private static final Logger jlog = LoggerFactory
.getLogger(ResourceFinder.class);
private static PolicyHandlerIface policydao;
@@ -107,15 +107,16 @@
try {
T resource = (T) iface
.findbyId(c.getPersistentID(), this.user);
- PolicyEvaluator e = PolicyEvaluator
- .setFlags(user, resource);
- resource.setManaged(e.getFlag("managed", false));
- resources.add(resource);
+ if (resource != null) {
+ PolicyEvaluator e = PolicyEvaluator
+ .setFlags(user, resource);
+ resource.setManaged(e.getFlag("managed", false));
+ resources.add(resource);
+ }
}catch (KustvaktException e) {
// don't handle connection error or no handler registered!
- KustvaktLogger.ERROR_LOGGER
- .error("Error while retrieving containers '{}' ",
- this.containers);
+ jlog.error("Error while retrieving containers '{}' ",
+ this.containers);
return Collections.emptySet();
}
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
index c3e3cee..85665c0 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
@@ -8,10 +8,10 @@
import de.ids_mannheim.korap.resources.Permissions;
import de.ids_mannheim.korap.resources.ResourceFactory;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Collection;
@@ -23,7 +23,7 @@
@SuppressWarnings("all")
public class ResourceHandler {
- private static Logger log = KustvaktLogger.getLogger(ResourceHandler.class);
+ private static Logger jlog = LoggerFactory.getLogger(ResourceHandler.class);
public ResourceHandler() {
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
index d1fc2b9..8fe09ad 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
@@ -14,8 +14,8 @@
import de.ids_mannheim.korap.security.PolicyCondition;
import de.ids_mannheim.korap.security.SecurityPolicy;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.*;
@@ -32,9 +32,9 @@
public class SecurityManager<T extends KustvaktResource> {
// private static final Logger errorLogger = LoggerFactory
- // .getLogger(KustvaktLogger.ERROR_LOG);
+ // .getLogger(LoggerFactory.ERROR_LOG);
- private static final Logger jlog = KustvaktLogger
+ private static final Logger jlog = LoggerFactory
.getLogger(SecurityManager.class);
private static PolicyHandlerIface policydao;
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index 9476fe7..854c81d 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -11,7 +11,6 @@
import de.ids_mannheim.korap.interfaces.db.AuditingIface;
import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
import de.ids_mannheim.korap.user.*;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.StringUtils;
import de.ids_mannheim.korap.utils.TimeUtils;
import net.sf.ehcache.Cache;
@@ -19,6 +18,7 @@
import net.sf.ehcache.Element;
import org.joda.time.DateTime;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CachePut;
import java.io.UnsupportedEncodingException;
@@ -35,7 +35,7 @@
public class KustvaktAuthenticationManager extends AuthenticationManagerIface {
private static String KEY = "kustvakt:key";
- private static Logger jlog = KustvaktLogger
+ private static Logger jlog = LoggerFactory
.getLogger(KustvaktAuthenticationManager.class);
private EncryptionIface crypto;
private EntityHandlerIface entHandler;
@@ -252,9 +252,9 @@
jlog.debug("Account is not yet activated for user '{}'",
user.getUsername());
if (TimeUtils.getNow().isAfter(param.getUriExpiration())) {
- KustvaktLogger.ERROR_LOGGER
- .error("URI token is expired. Deleting account for user {}",
- user.getUsername());
+ jlog.error(
+ "URI token is expired. Deleting account for user {}",
+ user.getUsername());
deleteAccount(user);
throw new WrappedException(
new KustvaktException(unknown.getId(),
@@ -268,9 +268,8 @@
StatusCodes.UNCONFIRMED_ACCOUNT),
StatusCodes.LOGIN_FAILED, username);
}
- KustvaktLogger.ERROR_LOGGER
- .error("ACCESS DENIED: account not active for '{}'",
- unknown.getUsername());
+ jlog.error("ACCESS DENIED: account not active for '{}'",
+ unknown.getUsername());
throw new WrappedException(
new KustvaktException(unknown.getId(),
StatusCodes.ACCOUNT_DEACTIVATED),
@@ -297,7 +296,7 @@
return null;
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("KorAPException", e);
+ jlog.error("KorAPException", e);
throw new KustvaktException(username, StatusCodes.ILLEGAL_ARGUMENT,
"username invalid", username);
}
@@ -329,8 +328,7 @@
try {
this.lockAccount(user);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER
- .error("user account could not be locked!", e);
+ jlog.error("user account could not be locked!", e);
throw new WrappedException(e,
StatusCodes.UPDATE_ACCOUNT_FAILED);
}
@@ -390,7 +388,7 @@
safeUser = crypto.validateString(username);
safePass = crypto.validatePassphrase(newPassphrase);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error", e);
+ jlog.error("Error", e);
throw new WrappedException(new KustvaktException(username,
StatusCodes.ILLEGAL_ARGUMENT, "password invalid",
newPassphrase), StatusCodes.PASSWORD_RESET_FAILED, username,
@@ -400,7 +398,7 @@
try {
safePass = crypto.produceSecureHash(safePass);
}catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
- KustvaktLogger.ERROR_LOGGER.error("Encoding/Algorithm Error", e);
+ jlog.error("Encoding/Algorithm Error", e);
throw new WrappedException(new KustvaktException(username,
StatusCodes.ILLEGAL_ARGUMENT, "password invalid",
newPassphrase), StatusCodes.PASSWORD_RESET_FAILED, username,
@@ -424,7 +422,7 @@
try {
safeUser = crypto.validateString(username);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("error", e);
+ jlog.error("error", e);
throw new WrappedException(e,
StatusCodes.ACCOUNT_CONFIRMATION_FAILED, username,
uriFragment);
@@ -476,7 +474,7 @@
try {
hash = crypto.produceSecureHash(safePass);
}catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
- KustvaktLogger.ERROR_LOGGER.error("Encryption error", e);
+ jlog.error("Encryption error", e);
throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
}
@@ -579,7 +577,7 @@
try {
result = entHandler.updateAccount(user) > 0;
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error ", e);
+ jlog.error("Error ", e);
throw new WrappedException(e,
StatusCodes.UPDATE_ACCOUNT_FAILED);
}
@@ -601,7 +599,7 @@
try {
result = entHandler.deleteAccount(user.getId()) > 0;
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error ", e);
+ jlog.error("Error ", e);
throw new WrappedException(e,
StatusCodes.DELETE_ACCOUNT_FAILED);
}
@@ -648,7 +646,7 @@
try {
entHandler.updateAccount(user);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error ", e);
+ jlog.error("Error ", e);
throw new WrappedException(e, StatusCodes.PASSWORD_RESET_FAILED);
}
return new Object[] { uritoken,
@@ -664,7 +662,7 @@
try {
entHandler.updateSettings(settings);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error ", e);
+ jlog.error("Error ", e);
throw new WrappedException(e,
StatusCodes.UPDATE_ACCOUNT_FAILED);
}
@@ -680,7 +678,7 @@
try {
entHandler.updateUserDetails(details);
}catch (KustvaktException e) {
- KustvaktLogger.ERROR_LOGGER.error("Error ", e);
+ jlog.error("Error ", e);
throw new WrappedException(e,
StatusCodes.UPDATE_ACCOUNT_FAILED);
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java b/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
index 62bf939..7f6ae2d 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
@@ -1,9 +1,9 @@
package de.ids_mannheim.korap.security.auth;
import de.ids_mannheim.korap.config.KustvaktConfiguration;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.HashMap;
@@ -15,7 +15,7 @@
*/
public class LoginCounter {
- private static Logger jlog = KustvaktLogger.getLogger(LoginCounter.class);
+ private static Logger jlog = LoggerFactory.getLogger(LoginCounter.class);
private final Map<String, Long[]> failedLogins;
private KustvaktConfiguration config;
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
index c02e2c8..3a74954 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
@@ -8,10 +8,10 @@
import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -25,7 +25,7 @@
*/
public class SessionAuthentication implements AuthenticationIface {
- private static Logger jlog = KustvaktLogger
+ private static Logger jlog = LoggerFactory
.getLogger(SessionAuthentication.class);
private SessionFactory sessions;
private ScheduledThreadPoolExecutor scheduled;
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java b/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
index b663479..426d594 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
@@ -5,10 +5,10 @@
import de.ids_mannheim.korap.user.DemoUser;
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.utils.ConcurrentMultiMap;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import de.ids_mannheim.korap.utils.TimeUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@@ -27,7 +27,7 @@
*/
public class SessionFactory implements Runnable {
- private static Logger jlog = KustvaktLogger.getLogger(SessionFactory.class);
+ private static Logger jlog = LoggerFactory.getLogger(SessionFactory.class);
private final ConcurrentMap<String, TokenContext> sessionsObject;
private final ConcurrentMap<String, DateTime> timeCheck;
diff --git a/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
index 5a003eb..87ec899 100644
--- a/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
+++ b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
@@ -1,14 +1,14 @@
package de.ids_mannheim.korap.user;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import lombok.Getter;
import lombok.Setter;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Getter
@Setter
public class KorAPUser extends User {
- private static Logger jlog = KustvaktLogger.getLogger(KorAPUser.class);
+ private static Logger jlog = LoggerFactory.getLogger(KorAPUser.class);
private static final long serialVersionUID = -7108308497625884584L;
//fixme: accountlink to shibboleth account
diff --git a/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java b/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
index 63d4533..cb7a976 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
@@ -9,6 +9,7 @@
* @date 28/03/2014
*/
+@Deprecated
public class KustvaktLogger implements Logger {
// debugging flag, info, warn, error will always be logged though!
public static boolean DEBUG = false;
diff --git a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
index ba81285..56e3c3d 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
@@ -2,11 +2,12 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.*;
public class StringUtils {
- private final static Logger jlog = KustvaktLogger
+ private final static Logger jlog = LoggerFactory
.getLogger(StringUtils.class);
private static final String SLASH = "/";
diff --git a/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
index 3f1835b..1da1fdc 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
@@ -6,6 +6,7 @@
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -25,7 +26,7 @@
private static DecimalFormat df = new DecimalFormat("#.#############");
private static final DateTimeZone dtz = DateTimeZone.forID("Europe/Berlin");
- private static Logger jlog = KustvaktLogger.getLogger(TimeUtils.class);
+ private static Logger jlog = LoggerFactory.getLogger(TimeUtils.class);
public static int convertTimeToSeconds(String expirationVal) {
expirationVal = expirationVal.trim();
diff --git a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
index e11447d..e8a6311 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
@@ -10,6 +10,7 @@
import de.ids_mannheim.korap.user.UserDetails;
import de.ids_mannheim.korap.user.UserSettings;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -28,7 +29,7 @@
private String path;
private EntityHandlerIface iface;
private EncryptionIface crypto;
- private static Logger jlog = KustvaktLogger
+ private static Logger jlog = LoggerFactory
.getLogger(UserPropertyReader.class);
public UserPropertyReader(String path) {
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 6a89cf8..69a843e 100644
--- a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -9,6 +9,8 @@
import de.ids_mannheim.korap.utils.KustvaktLogger;
import org.apache.lucene.store.MMapDirectory;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.nio.file.Paths;
import java.io.File;
import java.io.IOException;
@@ -21,7 +23,7 @@
*/
public class SearchKrill {
private final static Logger qlog = KustvaktLogger.getLogger("queryLogger");
- private final static Logger log = KustvaktLogger
+ private final static Logger log = LoggerFactory
.getLogger(SearchKrill.class);
// Temporary
String indexDir = "/data/prep_corpus/index/";
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
index 0817ede..293da84 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
@@ -16,9 +16,9 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.user.UserSettings;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
import net.minidev.json.JSONArray;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriBuilder;
@@ -36,7 +36,7 @@
private WebResource service;
// private static final String SERVICE = "http://localhost:8888";
private static final String SERVICE = "http://10.0.10.13";
- private static Logger jlog = KustvaktLogger.getLogger(PiwikFilter.class);
+ private static Logger jlog = LoggerFactory.getLogger(PiwikFilter.class);
public static boolean ENABLED = false;
private Map<String, String> customVars;
private AuthenticationManagerIface securityController;
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 3ded56a..d97b3fa 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -33,6 +33,7 @@
import de.ids_mannheim.korap.web.filter.PiwikFilter;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
@@ -47,8 +48,7 @@
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class ResourceService {
- private static Logger jlog = KustvaktLogger
- .getLogger(ResourceService.class);
+ private static Logger jlog = LoggerFactory.getLogger(ResourceService.class);
private SearchKrill searchKrill;
private ResourceHandler resourceHandler;
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index f526c63..fde88cd 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -17,6 +17,7 @@
import de.ids_mannheim.korap.web.TRACE;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@@ -35,7 +36,7 @@
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class LightService {
- private static Logger jlog = KustvaktLogger.getLogger(LightService.class);
+ private static Logger jlog = LoggerFactory.getLogger(LightService.class);
private SearchKrill searchKrill;
private ClientsHandler graphDBhandler;
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index ed7269f..c9186f6 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -20,9 +20,16 @@
log4j.appender.policyLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
log4j.appender.policyLog.File=./logs/policies.log
-log4j.logger.de.ids_mannheim.korap.security.ac = DEBUG, policyLog
+log4j.appender.authLog=org.apache.log4j.RollingFileAppender
+log4j.appender.authLog.layout=org.apache.log4j.PatternLayout
+log4j.appender.authLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
+log4j.appender.authLog.File=./logs/auth.log
log4j.appender.debugLog=org.apache.log4j.RollingFileAppender
log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout
log4j.appender.debugLog.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %C{6} - %M %n %-5p: %m%n
-log4j.appender.debugLog.File=./logs/logging.log
\ No newline at end of file
+log4j.appender.debugLog.File=./logs/logging.log
+
+
+log4j.logger.de.ids_mannheim.korap.security.ac = DEBUG, policyLog
+log4j.logger.de.ids_mannheim.korap.security.auth = DEBUG, authLog
\ No newline at end of file