diff src/org/tn5250j/GlobalConfigure.java @ 25:5949eb469a79 tn5250

adding tn5250 files, native android logging
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Jun 2014 12:10:21 -0700
parents e067ee54f638
children b29b39f386a4
line wrap: on
line diff
--- a/src/org/tn5250j/GlobalConfigure.java	Tue Jun 03 11:44:37 2014 -0700
+++ b/src/org/tn5250j/GlobalConfigure.java	Tue Jun 03 12:10:21 2014 -0700
@@ -39,8 +39,8 @@
 
 import com.five_ten_sg.connectbot.TerminalView;
 import org.tn5250j.interfaces.ConfigureFactory;
-import org.tn5250j.tools.logging.TN5250jLogFactory;
-import org.tn5250j.tools.logging.TN5250jLogger;
+import android.util.Log;
+
 
 /**
  * Utility class for referencing global settings and functions of which at most
@@ -64,7 +64,7 @@
 
     static private Hashtable registry = new Hashtable();
     static private Hashtable headers = new Hashtable();  //LUC GORRENS
-    private final TN5250jLogger log = TN5250jLogFactory.getLogger (this.getClass());
+
 
     /**
      * The constructor is made protected to allow overriding.
@@ -112,14 +112,10 @@
         final File f = new File (settingsfolder);
         if (!f.exists()) {
             try {
-                if (log.isInfoEnabled()) {
-                    log.info("Settings folder '"+settingsfolder+"' doesn't exist. Will created now.");
-                }
+                Log.i(TAG,"Settings folder '"+settingsfolder+"' doesn't exist. Will created now.");
                 f.mkdir();
             } catch (Exception e) {
-                if (log.isWarnEnabled()) {
-                    log.warn("Couldn't create settings folder '"+settingsfolder+"'", e);
-                }
+                Log.w(TAG,"Couldn't create settings folder '"+settingsfolder+"'", e);
             }
         }
     }
@@ -154,16 +150,12 @@
      */
     @Override
     public void reloadSettings() {
-        if (log.isInfoEnabled()) {
-            log.info("reloading settings");
-        }
+        Log.i(TAG,"reloading settings");
         loadSettings();
         loadSessions();
         loadMacros();
         loadKeyStrokes();
-        if (log.isInfoEnabled()) {
-            log.info("Done (reloading settings).");
-        }
+        Log.i(TAG,"Done (reloading settings).");
     }
 
     /**
@@ -179,18 +171,18 @@
             settings.load(in);
         }
         catch (FileNotFoundException fnfea) {
-            log.info(" Information Message: "
+            Log.i(TAG," Information Message: "
                     + fnfea.getMessage() + ".  The file " + settingsFile()
                     + " will be created for first time use.");
             saveSettings();
         }
         catch (IOException ioea) {
-            log.warn("IO Exception accessing File "
+            Log.w(TAG,"IO Exception accessing File "
                     + settingsFile() + " for the following reason : "
                     + ioea.getMessage());
         }
         catch (SecurityException sea) {
-            log.warn("Security Exception for file "
+            Log.w(TAG,"Security Exception for file "
                     + settingsFile() + "  This file can not be "
                     + "accessed because : " + sea.getMessage());
         }
@@ -255,17 +247,17 @@
                 out.close();
             }
             catch (FileNotFoundException fnfe) {
-                log.warn("File not found : writing file "
+                Log.w(TAG,"File not found : writing file "
                         + fileName + ".  Description of error is "
                         + fnfe.getMessage());
             }
             catch (IOException ioe) {
-                log.warn("IO Exception : writing file "
+                Log.w(TAG,"IO Exception : writing file "
                         + fileName + ".  Description of error is "
                         + ioe.getMessage());
             }
             catch (SecurityException se) {
-                log.warn("Security Exception : writing file "
+                Log.w(TAG,"Security Exception : writing file "
                         + fileName + ".  Description of error is "
                         + se.getMessage());
             }
@@ -323,7 +315,7 @@
         catch (FileNotFoundException fnfe) {
 
             if (createFile) {
-                log.info(" Information Message: " + fnfe.getMessage()
+                Log.i(TAG," Information Message: " + fnfe.getMessage()
                         + ".  The file " + fileName + " will"
                         + " be created for first time use.");
 
@@ -332,18 +324,18 @@
             }
             else {
 
-                log.info(" Information Message: " + fnfe.getMessage()
+                Log.i(TAG," Information Message: " + fnfe.getMessage()
                         + ".");
 
             }
         }
         catch (IOException ioe) {
-            log.warn("IO Exception accessing File "+ fileName +
+            Log.w(TAG,"IO Exception accessing File "+ fileName +
                     " for the following reason : "
                     + ioe.getMessage());
         }
         catch (SecurityException se) {
-            log.warn("Security Exception for file "+ fileName
+            Log.w(TAG,"Security Exception for file "+ fileName
                     + ".  This file can not be accessed because : "
                     + se.getMessage());
         }
@@ -404,7 +396,7 @@
             catch (FileNotFoundException fnfe) {
 
                 if (createFile) {
-                    log.info(" Information Message: " + fnfe.getMessage()
+                    Log.i(TAG," Information Message: " + fnfe.getMessage()
                             + ".  The file " + fileName + " will"
                             + " be created for first time use.");
 
@@ -417,18 +409,18 @@
                 }
                 else {
 
-                    log.info(" Information Message: " + fnfe.getMessage()
+                    Log.i(TAG," Information Message: " + fnfe.getMessage()
                             + ".");
 
                 }
             }
             catch (IOException ioe) {
-                log.warn("IO Exception accessing File "+ fileName +
+                Log.w(TAG,"IO Exception accessing File "+ fileName +
                         " for the following reason : "
                         + ioe.getMessage());
             }
             catch (SecurityException se) {
-                log.warn("Security Exception for file "+ fileName
+                Log.w(TAG,"Security Exception for file "+ fileName
                         + ".  This file can not be accessed because : "
                         + se.getMessage());
             }