Java Code Examples for com.alipay.api.AlipayConstants#SDK_VERSION

The following examples show how to use com.alipay.api.AlipayConstants#SDK_VERSION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlipayLogger.java    From alipay-sdk-java-all with Apache License 2.0 5 votes vote down vote up
/**
 * 通讯错误日志
 */
private static void _logCommError(Exception e, HttpURLConnection conn, String url,
                                  String appKey, String method, Map<String, String> params) {
    DateFormat df = new SimpleDateFormat(AlipayConstants.DATE_TIME_FORMAT);
    df.setTimeZone(TimeZone.getTimeZone(AlipayConstants.DATE_TIMEZONE));
    String sdkName = AlipayConstants.SDK_VERSION;
    String urlStr = null;
    String rspCode = "";
    if (conn != null) {
        try {
            urlStr = conn.getURL().toString();
            rspCode = "HTTP_ERROR_" + conn.getResponseCode();
        } catch (IOException ioe) {
        }
    } else {
        urlStr = url;
        rspCode = "";
    }
    StringBuilder sb = new StringBuilder();
    sb.append(df.format(new Date()));// 时间
    sb.append("^_^");
    sb.append(method);// API
    sb.append("^_^");
    sb.append(appKey);// APP
    sb.append("^_^");
    sb.append(getIp());// IP地址
    sb.append("^_^");
    sb.append(osName);// 操作系统
    sb.append("^_^");
    sb.append(sdkName);// SDK名字,这是例子,请换成其他名字
    sb.append("^_^");
    sb.append(urlStr);// 请求URL
    sb.append("^_^");
    sb.append(rspCode);
    sb.append("^_^");
    sb.append((e.getMessage() + "").replaceAll("\r\n", " "));
    clog.error(sb.toString());
}
 
Example 2
Source File: AlipayLogger.java    From alipay-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 通讯错误日志
 */
private static void _logCommError(Exception e, HttpURLConnection conn, String url,
                                  String appKey, String method, Map<String, String> params) {
    DateFormat df = new SimpleDateFormat(AlipayConstants.DATE_TIME_FORMAT);
    df.setTimeZone(TimeZone.getTimeZone(AlipayConstants.DATE_TIMEZONE));
    String sdkName = AlipayConstants.SDK_VERSION;
    String urlStr = null;
    String rspCode = "";
    if (conn != null) {
        try {
            urlStr = conn.getURL().toString();
            rspCode = "HTTP_ERROR_" + conn.getResponseCode();
        } catch (IOException ioe) {
        }
    } else {
        urlStr = url;
        rspCode = "";
    }
    StringBuilder sb = new StringBuilder();
    sb.append(df.format(new Date()));// 时间
    sb.append("^_^");
    sb.append(method);// API
    sb.append("^_^");
    sb.append(appKey);// APP
    sb.append("^_^");
    sb.append(getIp());// IP地址
    sb.append("^_^");
    sb.append(osName);// 操作系统
    sb.append("^_^");
    sb.append(sdkName);// SDK名字,这是例子,请换成其他名字
    sb.append("^_^");
    sb.append(urlStr);// 请求URL
    sb.append("^_^");
    sb.append(rspCode);
    sb.append("^_^");
    sb.append((e.getMessage() + "").replaceAll("\r\n", " "));
    clog.error(sb.toString());
}
 
Example 3
Source File: AlipayLogger.java    From pay with Apache License 2.0 5 votes vote down vote up
private static void _logCommError(Exception e, HttpURLConnection conn, String url,
                                  String appKey, String method, Map<String, String> params) {
    DateFormat df = new SimpleDateFormat(AlipayConstants.DATE_TIME_FORMAT);
    df.setTimeZone(TimeZone.getTimeZone(AlipayConstants.DATE_TIMEZONE));
    String sdkName = AlipayConstants.SDK_VERSION;
    String urlStr = null;
    String rspCode = "";
    if (conn != null) {
        try {
            urlStr = conn.getURL().toString();
            rspCode = "HTTP_ERROR_" + conn.getResponseCode();
        } catch (IOException ioe) {
        }
    } else {
        urlStr = url;
        rspCode = "";
    }
    StringBuilder sb = new StringBuilder();
    sb.append(df.format(new Date()));// 时间
    sb.append("^_^");
    sb.append(method);// API
    sb.append("^_^");
    sb.append(appKey);// APP
    sb.append("^_^");
    sb.append(getIp());// IP地址
    sb.append("^_^");
    sb.append(osName);// 操作系统
    sb.append("^_^");
    sb.append(sdkName);// SDK名字,这是例子,请换成其他名字
    sb.append("^_^");
    sb.append(urlStr);// 请求URL
    sb.append("^_^");
    sb.append(rspCode);
    sb.append("^_^");
    sb.append((e.getMessage() + "").replaceAll("\r\n", " "));
    clog.error(sb.toString());
}