git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@78912 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c4c495fb9a
commit
ed253ceaa7
|
@ -8,6 +8,7 @@ import java.util.Properties;
|
|||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.apache.log4j.spi.RootLogger;
|
||||
|
||||
public class AnalysisLogger {
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class AnalysisLogger {
|
|||
org.apache.log4j.BasicConfigurator.configure();
|
||||
// logger = Logger.getLogger("ConsoleAppender");
|
||||
logger = Logger.getRootLogger();
|
||||
logger.setLevel(Level.INFO);
|
||||
logger.setLevel(Level.TRACE);
|
||||
}
|
||||
|
||||
return logger;
|
||||
|
@ -29,7 +30,9 @@ public class AnalysisLogger {
|
|||
|
||||
// in ingresso vuole il path al file di config del log4j
|
||||
public static void setLogger(String path) {
|
||||
if (logger == null) {
|
||||
|
||||
if (logger == null || (logger instanceof RootLogger)) {
|
||||
System.out.println("EcologicalEnginLibrary: setting logger to "+path);
|
||||
File f = new File(path);
|
||||
if (f.exists())
|
||||
PropertyConfigurator.configure(path);
|
||||
|
@ -40,12 +43,14 @@ public class AnalysisLogger {
|
|||
p.load(is);
|
||||
is.close();
|
||||
} catch (IOException e1) {
|
||||
System.out.println("EcologicalEnginLibrary: Error in reading file"+path+" : "+e1.getLocalizedMessage());
|
||||
}
|
||||
PropertyConfigurator.configure(p);
|
||||
}
|
||||
}
|
||||
logger = Logger.getLogger("AnalysisLogger");
|
||||
hibernateLogger = Logger.getLogger("hibernate");
|
||||
|
||||
}
|
||||
|
||||
public static void printStackTrace(Exception e) {
|
||||
|
|
Loading…
Reference in New Issue