X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fbin%2FCache.java;h=eb503d5858440a6954f8a4db74b040549fceb438;hb=8b875ed4be8113683a34f4d4df36b3a6bb1c556e;hp=d5757df9ce15fd5fa9c19f4e8e50ef3d073d35fc;hpb=d85d2bf55610bc799dd67d7f9ed6b494632e5420;p=jalview.git
diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java
index d5757df..eb503d5 100755
--- a/src/jalview/bin/Cache.java
+++ b/src/jalview/bin/Cache.java
@@ -22,7 +22,10 @@ import java.io.*;
import java.util.*;
-import java.net.*;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Level;
+import org.apache.log4j.ConsoleAppender;
/**
@@ -30,6 +33,9 @@ import java.net.*;
*
Current properties include:
*
logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)
*
logs.Castor.Level - one of the stringified Levels for log4j controlling the logging level for castor (used for serialization)
+ *
logs.Jalview.Level - Cache.log stringified level.
+ *
DISCOVERY_START - Boolean - controls if discovery services are queried on startup
+ *
DISCOVERY_URLS - comma separated list of Discovery Service endpoints.
*
SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_Y=285,SCREEN_X=371,SHOW_FULLSCREEN
* FONT_NAME,FONT_SIZE,FONT_STYLE,GAP_SYMBOL,LAST_DIRECTORY,USER_DEFINED_COLOUR
* SHOW_FULL_ID,SHOW_IDENTITY,SHOW_QUALITY,SHOW_ANNOTATIONS,SHOW_CONSERVATION,
@@ -40,6 +46,10 @@ import java.net.*;
*/
public class Cache
{
+ /**
+ * Initialises the Apache Axis logger
+ */
+ public static Logger log;
/** Jalview Properties */
public static Properties applicationProperties = new Properties();
@@ -47,6 +57,38 @@ public class Cache
/** Default file is ~/.jalview_properties */
static String propertiesFile;
+ public static void initLogger()
+ {
+ try
+ {
+ Logger laxis = Logger.getLogger("org.apache.axis");
+ Logger lcastor = Logger.getLogger("org.exolab.castor");
+ jalview.bin.Cache.log = Logger.getLogger("jalview.bin.Jalview");
+
+ laxis.setLevel(Level.toLevel(Cache.getDefault("logs.Axis.Level",
+ Level.INFO.toString())));
+ lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level",
+ Level.INFO.toString())));
+ jalview.bin.Cache.log.setLevel(Level.toLevel(Cache.getDefault(
+ "logs.Jalview.level",
+ Level.INFO.toString())));
+ ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),
+ "System.err");
+ ap.setName("JalviewLogger");
+
+ laxis.addAppender(ap);
+ lcastor.addAppender(ap);
+ jalview.bin.Cache.log.addAppender(ap);
+ // Tell the user that debug is enabled
+ jalview.bin.Cache.log.debug("Jalview Debugging Output Follows.");
+ }
+ catch (Exception ex)
+ {
+ System.err.println("Problems initializing the log4j system\n");
+ }
+ }
+
+
/** Called when Jalview is started */
public static void loadProperties(String propsFile)
{
@@ -112,7 +154,8 @@ public class Cache
}
- System.out.println("Version: "+codeVersion);
+ System.out.println("Jalview Version: "+codeVersion);
+
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
@@ -121,7 +164,6 @@ public class Cache
|| System.getProperty("java.awt.headless").equals("false")))
{
-
class VersionChecker
extends Thread
{
@@ -161,10 +203,17 @@ public class Cache
}
else
{
- setProperty("LATEST_VERSION", jnlpVersion);
+ if(jnlpVersion!=null)
+ setProperty("LATEST_VERSION", jnlpVersion);
+ else
+ applicationProperties.remove("LATEST_VERSION");
}
setProperty("VERSION", codeVersion);
+
+ //LOAD USERDEFINED COLOURS
+ jalview.gui.UserDefinedColours.initUserColourSchemes( getProperty("USER_DEFINED_COLOURS"));
+ jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER", false);
}
@@ -231,7 +280,7 @@ public class Cache
out.close();
}
catch (Exception ex)
- { }
+ { System.out.println("Error setting property: "+key+" "+obj+"\n"+ex); }
return obj;
}
@@ -244,6 +293,6 @@ public class Cache
out.close();
}
catch (Exception ex)
- { }
+ { System.out.println("Error saving properties: "+ex); }
}
}