X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=eb503d5858440a6954f8a4db74b040549fceb438;hb=c42fcf7bf5cfcf51e67dd0f683edb9ab6683d157;hp=485f9ec8e32a5d341c2e1cfa14542b86606dcd3b;hpb=87fd27f8449d6f4802d154072d9d6e876e22a846;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 485f9ec..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) { @@ -114,6 +156,7 @@ public class Cache System.out.println("Jalview Version: "+codeVersion); + // jnlpVersion will be null if we're using InstallAnywhere // Dont do this check if running in headless mode if(jnlpVersion==null && ( @@ -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); } } }