diff --git a/etc/spring/medcoapp/medco.properties b/etc/spring/medcoapp/medco.properties
index 027f95f..3ddaa82 100755
--- a/etc/spring/medcoapp/medco.properties
+++ b/etc/spring/medcoapp/medco.properties
@@ -1,27 +1,27 @@
###############################################
## Application properties for MedCo Cell ##
###############################################
# i2b2 cells communications
medco.i2b2.pm.url=http://localhost:8080/i2b2/services/PMService
medco.i2b2.ont.url=http://localhost:8080/i2b2/services/OntologyService
medco.i2b2.fr.url=http://localhost:8080/i2b2/services/FRService
medco.i2b2.crc.url=http://localhost:8080/i2b2/services/QueryToolService
medco.i2b2.waittimems=6000000
# unlynx communications
medco.unlynx.binarypath=/opt/configuration/unlynxI2b2
# todo: change for experiments
-medco.unlynx.debuglevel=1
+medco.unlynx.debuglevel=5
medco.unlynx.proofs=0
# changed according to config
medco.unlynx.groupfilepath=/opt/configuration/keys/srv1-3-5-group.toml
medco.unlynx.entrypointidx=0
# general config
medco.app.name=MedCo I2B2 cell
medco.app.version=0.01
medco.log.level=DEBUG
diff --git a/src/server/ch/epfl/lca1/medco/util/Logger.java b/src/server/ch/epfl/lca1/medco/util/Logger.java
index bb55902..db47a3e 100644
--- a/src/server/ch/epfl/lca1/medco/util/Logger.java
+++ b/src/server/ch/epfl/lca1/medco/util/Logger.java
@@ -1,276 +1,274 @@
package ch.epfl.lca1.medco.util;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.BasicConfigurator;
import org.apache.commons.logging.Log;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.PatternLayout;
/**
* Static log class, supports logging of the following severities:
* fatal, error, warn, info, debug, trace
*
* Use a {@link SecurityManager} to automatically get the caller class.
+ *
+ * Should be configured via a side channel (e.g. log4j.properties file server-side, or programmatically client-side)
*
* @author Mickael Misbach
*/
public class Logger {
/**
* Internal class used to access the caller class.
*
* @see Inspiration
*/
private static class CallerProvider extends SecurityManager {
/**
* Depth in the stack to get the caller class.
* 0: CallerProvider#getClassContext,
* 1: CallerProvider#getCallerClass,
* 2: Logger (one of the logging methods),
* 3: the outside caller class
*/
private static final int STACK_DEPTH = 3;
private Class> getCallerClass() {
return getClassContext()[STACK_DEPTH];
}
}
/**
* Static class, cannot be instanced.
*/
private Logger() { }
/**
* Instance of the log factory used to generate the {@link Log} instances.
*/
private static LogFactory logFactory = LogFactory.getFactory();
- static { // todo:
- BasicConfigurator.configure();
- }
-
/**
* Instance of the caller provider class.
*/
private static CallerProvider callerProvider = new CallerProvider();
// ----------------------------------------------------
// level fatal
// ----------------------------------------------------
/**
* Log a fatal message.
*
* @param msg the log message
*/
public static void fatal(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).fatal(msg);
}
/**
* Log a fatal throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T fatal(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).fatal(t.getMessage(), t);
return t;
}
/**
* Log a fatal message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T fatal(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).fatal(msg, t);
return t;
}
// ----------------------------------------------------
// level error
// ----------------------------------------------------
/**
* Log an error message.
*
* @param msg the log message
*/
public static void error(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).error(msg);
}
/**
* Log an error throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T error(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).error(t.getMessage(), t);
return t;
}
/**
* Log an error message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T error(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).error(msg, t);
return t;
}
// ----------------------------------------------------
// level warn
// ----------------------------------------------------
/**
* Log a warn message.
*
* @param msg the log message
*/
public static void warn(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).warn(msg);
}
/**
* Log a warn throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T warn(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).warn(t.getMessage(), t);
return t;
}
/**
* Log a warn message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T warn(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).warn(msg, t);
return t;
}
// ----------------------------------------------------
// level info
// ----------------------------------------------------
/**
* Log an info message.
*
* @param msg the log message
*/
public static void info(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).info(msg);
}
/**
* Log an info throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T info(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).info(t.getMessage(), t);
return t;
}
/**
* Log an info message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T info(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).info(msg, t);
return t;
}
// ----------------------------------------------------
// level debug
// ----------------------------------------------------
/**
* Log a debug message.
*
* @param msg the log message
*/
public static void debug(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).debug(msg);
}
/**
* Log a debug throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T debug(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).debug(t.getMessage(), t);
return t;
}
/**
* Log a debug message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T debug(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).debug(msg, t);
return t;
}
// ----------------------------------------------------
// level trace
// ----------------------------------------------------
/**
* Log a trace message.
*
* @param msg the log message
*/
public static void trace(String msg) {
logFactory.getInstance(callerProvider.getCallerClass()).trace(msg);
}
/**
* Log a trace throwable.
*
* @param t the log throwable
* @return the throwable
*/
public static T trace(T t) {
logFactory.getInstance(callerProvider.getCallerClass()).trace(t.getMessage(), t);
return t;
}
/**
* Log a trace message and throwable.
*
* @param msg the log message
* @param t the log throwable
* @return the throwable
*/
public static T trace(String msg, T t) {
logFactory.getInstance(callerProvider.getCallerClass()).trace(msg, t);
return t;
}
}