X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=eb503d5858440a6954f8a4db74b040549fceb438;hb=47aec94b56baa5b666c3189280f4d1d5c7567a95;hp=480bf5db0596650d743c129d1961621f203b6cdb;hpb=38086bb11e3db63ddea8a9805f813d21668d7e8f;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 480bf5d..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,7 +33,7 @@ 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 - Jalview.log stringified level. + *
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 @@ -43,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(); @@ -50,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) { @@ -117,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 && ( @@ -124,7 +164,6 @@ public class Cache || System.getProperty("java.awt.headless").equals("false"))) { - class VersionChecker extends Thread { @@ -164,13 +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); }