diff --git a/common/src/main/java/com/yunbao/common/http/HttpCallback.java b/common/src/main/java/com/yunbao/common/http/HttpCallback.java index 404aab7e5..7b1c6b411 100644 --- a/common/src/main/java/com/yunbao/common/http/HttpCallback.java +++ b/common/src/main/java/com/yunbao/common/http/HttpCallback.java @@ -36,7 +36,6 @@ public abstract class HttpCallback extends AbsCallback { public void onSuccess(Response response) { JsonBean bean = response.body(); String gson = new Gson().toJson(bean); - Log.e("onSuccess", gson); if (bean != null) { if (200 == bean.getRet()) { Data data = bean.getData(); diff --git a/common/src/main/java/com/yunbao/common/http/HttpLoggingInterceptor.java b/common/src/main/java/com/yunbao/common/http/HttpLoggingInterceptor.java index 7df49adbe..74acc0e19 100644 --- a/common/src/main/java/com/yunbao/common/http/HttpLoggingInterceptor.java +++ b/common/src/main/java/com/yunbao/common/http/HttpLoggingInterceptor.java @@ -133,15 +133,18 @@ public class HttpLoggingInterceptor implements Interceptor { ResponseBody responseBody = clone.body(); boolean logBody = (printLevel == Level.BODY); boolean logHeaders = (printLevel == Level.BODY || printLevel == Level.HEADERS); - + StringBuilder sb=new StringBuilder(); try { - log("<-- " + clone.code() + ' ' + clone.message() + ' ' + clone.request().url() + " (" + tookMs + "ms)"); + sb.append("<-- ").append(clone.code()) + .append(' ').append(clone.message()) + .append(' ').append(clone.request().url()) + .append(" (").append(tookMs).append("ms)\n"); if (logHeaders) { Headers headers = clone.headers(); for (int i = 0, count = headers.size(); i < count; i++) { - log("\t" + headers.name(i) + ": " + headers.value(i)); + sb.append("\t").append(headers.name(i)).append(": ").append(headers.value(i)).append("\n"); } - log(" "); + sb.append("\n"); if (logBody && HttpHeaders.hasBody(clone)) { if (responseBody == null) return response; @@ -149,18 +152,19 @@ public class HttpLoggingInterceptor implements Interceptor { byte[] bytes = IOUtils.toByteArray(responseBody.byteStream()); MediaType contentType = responseBody.contentType(); String body = new String(bytes, getCharset(contentType)); - log("\tbody:" + body); + sb.append("\tbody:").append(body).append("\n"); responseBody = ResponseBody.create(responseBody.contentType(), bytes); return response.newBuilder().body(responseBody).build(); } else { - log("\tbody: maybe [binary body], omitted!"); + sb.append("\tbody: maybe [binary body], omitted!").append("\n"); } } } } catch (Exception e) { OkLogger.printStackTrace(e); } finally { - log("<-- END HTTP"); + sb.append("<-- END HTTP").append("\n"); + log(sb.toString()); } return response; } diff --git a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java index a01ed1f0e..af19dc222 100644 --- a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java +++ b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java @@ -58,7 +58,9 @@ public class UploadQnImpl implements UploadStrategy { assert response != null; mList.get(mIndex).setRemoteAccessUrl(response.getString("key")); } catch (JSONException e) { - throw new RuntimeException(e); + // throw new RuntimeException(e); + L.e(e); + return; } if (mList == null || mList.size() == 0) { if (mUploadCallback != null) { diff --git a/common/src/main/java/com/yunbao/common/utils/L.java b/common/src/main/java/com/yunbao/common/utils/L.java index c1eaf1fab..3cf47f2b8 100644 --- a/common/src/main/java/com/yunbao/common/utils/L.java +++ b/common/src/main/java/com/yunbao/common/utils/L.java @@ -2,6 +2,8 @@ package com.yunbao.common.utils; import android.util.Log; +import org.json.JSONException; + import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; @@ -42,6 +44,10 @@ public class L { } public static void setDeBug(boolean deBug) { - sDeBug = false; + sDeBug = deBug; + } + + public static void e(Exception e) { + Log.e("Exception", e.getMessage(), e); } } diff --git a/common/src/main/java/com/yunbao/common/utils/LogUtil.java b/common/src/main/java/com/yunbao/common/utils/LogUtil.java index b4656c18e..20d57e249 100644 --- a/common/src/main/java/com/yunbao/common/utils/LogUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/LogUtil.java @@ -160,7 +160,6 @@ public class LogUtil { ZipUtils.zipFolder(srcList, zip.getAbsolutePath(), filters, new Runnable() { @Override public void run() { - System.out.println("!!!!!!!!!!!!!!!!!!!"); if (BuildConfig.DEBUG) { return; } diff --git a/common/src/main/java/com/yunbao/common/utils/LogUtils.java b/common/src/main/java/com/yunbao/common/utils/LogUtils.java index 81826b03a..6557a64ab 100644 --- a/common/src/main/java/com/yunbao/common/utils/LogUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/LogUtils.java @@ -120,9 +120,6 @@ public class LogUtils { public static void endSafeLog() { writerSafeLog = false; - while (!QUEUE.isEmpty()){ - - } } /**