aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/Log.java
diff options
context:
space:
mode:
authorAndrew Su <[email protected]>2011-01-17 13:44:31 -0500
committerAndrew Su <[email protected]>2011-01-17 13:44:31 -0500
commite9f1f6b9df10ddcb59335321329fdb5ef13cf8e9 (patch)
tree0c4f186cf0ca1773ece7684e9d32592d258559c6 /netx/net/sourceforge/jnlp/Log.java
parentc361508174a8703a002d3231068c73c2fc93b967 (diff)
Add logging for applet exceptions.
Diffstat (limited to 'netx/net/sourceforge/jnlp/Log.java')
-rw-r--r--netx/net/sourceforge/jnlp/Log.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/Log.java b/netx/net/sourceforge/jnlp/Log.java
new file mode 100644
index 0000000..a7aa102
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/Log.java
@@ -0,0 +1,42 @@
+package net.sourceforge.jnlp;
+
+import java.io.File;
+
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * This file provides the information required to do logging.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+abstract class Log {
+
+ // Directory where the logs are stored.
+ protected static String icedteaLogDir;
+
+ protected static boolean enableLogging = false;
+ protected static boolean enableTracing = false;
+
+ // Prepare for logging.
+ static {
+ DeploymentConfiguration config = JNLPRuntime.getConfiguration();
+
+ // Check whether logging and tracing is enabled.
+ enableLogging = Boolean.parseBoolean(config.getProperty(DeploymentConfiguration.KEY_ENABLE_LOGGING));
+ enableTracing = Boolean.parseBoolean(config.getProperty(DeploymentConfiguration.KEY_ENABLE_TRACING));
+
+ // Get log directory, create it if it doesn't exist. If unable to create and doesn't exist, don't log.
+ icedteaLogDir = config.getProperty(DeploymentConfiguration.KEY_USER_LOG_DIR);
+ if (icedteaLogDir != null) {
+ File f = new File(icedteaLogDir);
+ if (f.isDirectory() || f.mkdirs())
+ icedteaLogDir += File.separator;
+ else {
+ enableLogging = false;
+ enableTracing = false;
+ }
+ }
+ }
+}