Revision: 2332
http://sourceforge.net/p/swingme/code/2332
Author: yuranet
Date: 2014-12-26 15:54:07 +0000 (Fri, 26 Dec 2014)
Log Message:
-----------
message needed for logging a throwable
Modified Paths:
--------------
UtilME/src/net/yura/mobile/io/CSVUtil.java
UtilME/src/net/yura/mobile/logging/Logger.java
UtilME/src/net/yura/mobile/util/QueueProcessorThread.java
UtilME/src/net/yura/mobile/util/Timer.java
UtilME/src/net/yura/mobile/util/Url.java
Modified: UtilME/src/net/yura/mobile/io/CSVUtil.java
===================================================================
--- UtilME/src/net/yura/mobile/io/CSVUtil.java 2014-12-21 18:43:21 UTC (rev 2331)
+++ UtilME/src/net/yura/mobile/io/CSVUtil.java 2014-12-26 15:54:07 UTC (rev 2332)
@@ -94,10 +94,10 @@
finally {
try { if (inputStreamTxt!=null) inputStreamTxt.close(); }
- catch(IOException ex) { Logger.info(ex); }
+ catch(IOException ex) { Logger.info(null, ex); }
try {if (inputStream!=null) inputStream.close(); }
- catch(IOException ex) { Logger.info(ex); }
+ catch(IOException ex) { Logger.info(null, ex); }
}
}
@@ -154,10 +154,10 @@
finally {
try { if (writer!=null) writer.close(); }
- catch(IOException ex) { Logger.info(ex); }
+ catch(IOException ex) { Logger.info(null, ex); }
try { if (out!=null) out.close(); }
- catch(IOException ex) { Logger.info(ex); }
+ catch(IOException ex) { Logger.info(null, ex); }
}
}
Modified: UtilME/src/net/yura/mobile/logging/Logger.java
===================================================================
--- UtilME/src/net/yura/mobile/logging/Logger.java 2014-12-21 18:43:21 UTC (rev 2331)
+++ UtilME/src/net/yura/mobile/logging/Logger.java 2014-12-26 15:54:07 UTC (rev 2332)
@@ -68,7 +68,7 @@
*/
//#mdebug debug
public static void debug(String message) {
- if(level<=DEBUG) logger.log(message, DEBUG);
+ if (level <= DEBUG) logger.log(message, DEBUG);
}
//#enddebug
@@ -78,9 +78,9 @@
* should work at the info level most of the time to avoid all the output.
* Expected exceptions can be reported on the debug level
*/
- public static void debug(Throwable exception) {
+ public static void debug(String error, Throwable exception) {
//#debug debug
- if(level<=DEBUG) logger.log(exception, DEBUG);
+ if (level <= DEBUG) logger.log(error, exception, DEBUG);
}
/**
@@ -91,7 +91,7 @@
*/
//#mdebug info
public static void info(String message) {
- if(level<=INFO) logger.log(message, INFO);
+ if (level <= INFO) logger.log(message, INFO);
}
//#enddebug
@@ -101,9 +101,9 @@
* output should use the debug level. Unexpected exceptions without
* implications can be reported on the info level.
*/
- public static void info(Throwable exception) {
+ public static void info(String error, Throwable exception) {
//#debug info
- if(level<=INFO) logger.log(exception, INFO);
+ if (level <= INFO) logger.log(error, exception, INFO);
}
/**
@@ -112,7 +112,7 @@
*/
//#mdebug warn
public static void warn(String message) {
- if(level<=WARN) logger.log(message, WARN);
+ if (level <= WARN) logger.log(message, WARN);
}
//#enddebug
@@ -121,9 +121,9 @@
* with implications and errors can be reported on the warn level. Warn
* logging can also and should be used for assertions.
*/
- public static void warn(Throwable exception) {
+ public static void warn(String error, Throwable exception) {
//#debug warn
- if(level<=WARN) logger.log(exception, WARN);
+ if (level <= WARN) logger.log(error, exception, WARN);
}
/**
@@ -133,7 +133,7 @@
*/
//#mdebug warn
public static void warn(boolean assertion) {
- if(level<=WARN && assertion) throw new IllegalArgumentException("Assertion failed");
+ if (level <= WARN && assertion) throw new IllegalArgumentException("Assertion failed");
}
//#enddebug
@@ -145,7 +145,7 @@
//#mdebug error
public static void error(String message) {
//#debug error
- if(level<=ERROR) logger.log(message, ERROR);
+ if (level <= ERROR) logger.log(message, ERROR);
}
//#enddebug
@@ -154,9 +154,9 @@
* even on a release build. Throwable try catch blocks surrounding code entry
* points should report on the error level.
*/
- public static void error(Throwable throwable) {
+ public static void error(String error, Throwable throwable) {
//#debug error
- if(level<=ERROR) logger.log(throwable, ERROR);
+ if (level <= ERROR) logger.log(error, throwable, ERROR);
}
/**
@@ -185,9 +185,9 @@
out.println(toString(level) + message);
}
- protected synchronized void log(Throwable throwable, int level)
+ protected synchronized void log(String error, Throwable throwable, int level)
{
- System.err.println(toString(level) +" "+ throwable);
+ System.err.println(toString(level) + (error == null ? "" : " " + error) + " " + throwable);
throwable.printStackTrace();
}
}
Modified: UtilME/src/net/yura/mobile/util/QueueProcessorThread.java
===================================================================
--- UtilME/src/net/yura/mobile/util/QueueProcessorThread.java 2014-12-21 18:43:21 UTC (rev 2331)
+++ UtilME/src/net/yura/mobile/util/QueueProcessorThread.java 2014-12-26 15:54:07 UTC (rev 2332)
@@ -80,7 +80,7 @@
wait();
}
catch (InterruptedException ex) {
- Logger.info(ex);
+ Logger.info(null, ex);
// TODO do something!!!!
}
}
@@ -103,18 +103,14 @@
}
}
catch (Exception ex) {
- //#mdebug warn
- Logger.warn("[QueueProcessorThread-"+Thread.currentThread().getName()+"] error processing "+object);
- Logger.warn(ex);
- //#enddebug
+ //#debug warn
+ Logger.warn("[QueueProcessorThread-" + Thread.currentThread().getName() + "] error processing "+object, ex);
}
}
}
catch(Throwable t) {
- //#mdebug error
- Logger.error("[QueueProcessorThread-"+Thread.currentThread().getName()+"] fatal error: "+t.toString());
- Logger.error(t);
- //#enddebug
+ //#debug error
+ Logger.error("[QueueProcessorThread-" + Thread.currentThread().getName() + "] fatal error", t);
}
}
Modified: UtilME/src/net/yura/mobile/util/Timer.java
===================================================================
--- UtilME/src/net/yura/mobile/util/Timer.java 2014-12-21 18:43:21 UTC (rev 2331)
+++ UtilME/src/net/yura/mobile/util/Timer.java 2014-12-26 15:54:07 UTC (rev 2332)
@@ -40,7 +40,7 @@
}
catch (InterruptedException e) {
//#debug info
- Logger.info(e);
+ Logger.info(null, e);
}
if (cancelled) return;
@@ -52,8 +52,7 @@
}
catch (Throwable t) {
//#debug warn
- Logger.warn("error in ("+id+") timer: "+t.toString());
- Logger.error(t);
+ Logger.warn("error in (" + id + ") timer", t);
}
}
Modified: UtilME/src/net/yura/mobile/util/Url.java
===================================================================
--- UtilME/src/net/yura/mobile/util/Url.java 2014-12-21 18:43:21 UTC (rev 2331)
+++ UtilME/src/net/yura/mobile/util/Url.java 2014-12-26 15:54:07 UTC (rev 2332)
@@ -207,11 +207,10 @@
getPostString(map,writer);
return buff.toString();
*/
-
}
catch (IOException ex) {
//#debug debug
- Logger.warn(ex);
+ Logger.warn("error with " + map, ex);
throw new RuntimeException( ex.toString() );
}
}
@@ -257,7 +256,7 @@
}
catch(IOException ex) {
//#debug debug
- Logger.warn(ex);
+ Logger.warn("error encoding " + s, ex);
throw new RuntimeException( ex.toString() );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|