javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java
changeset 80 d6dafc5d983f
parent 72 1f0034e370aa
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java	Mon Oct 04 11:29:25 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java	Fri Oct 15 12:29:39 2010 +0300
@@ -161,18 +161,20 @@
     //private static ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
     //private static PrintStream print_stream = new PrintStream(byte_stream);
 
+    private static boolean mNativeAvailable = false;
+
     static
     {
 
         try
         {
             Jvm.loadSystemLibrary("javautils");
+            mNativeAvailable = true;
         }
 
-        catch (Exception e)
+        catch (Throwable t)
         {
-
-            System.err.println(e.toString());
+            System.err.println("Error loading javautils: " + t);
         }
     }
 
@@ -345,7 +347,24 @@
         }
         else
         {
-            _logging(component, level, str, DebugUtils.getStackTrace(thrown));
+            if (mNativeAvailable)
+            {
+                _logging(component, level, str, DebugUtils.getStackTrace(thrown));
+            }
+            else
+            {
+                PrintStream printStream = System.out;
+                if (level == EError || level == EWarning)
+                {
+                    printStream = System.err;
+                }
+                printStream.println("Component: " + component + ", level: " +
+                                    level + ", msg: " + str);
+                if (thrown != null)
+                {
+                    thrown.printStackTrace();
+                }
+            }
         }
     }