Example usage for com.google.gwt.logging.server RemoteLoggingServiceUtil logOnServer

List of usage examples for com.google.gwt.logging.server RemoteLoggingServiceUtil logOnServer

Introduction

In this page you can find the example usage for com.google.gwt.logging.server RemoteLoggingServiceUtil logOnServer.

Prototype

public static void logOnServer(String serializedLogRecordJson, String strongName,
            StackTraceDeobfuscator deobfuscator, String loggerNameOverride) throws RemoteLoggingException 

Source Link

Usage

From source file:com.google.web.bindery.requestfactory.server.Logging.java

License:Apache License

/**
 * Logs a message./*from  w  ww  .java  2s  .  c  o m*/
 * 
 * @param logRecordJson a json serialized LogRecord, as provided by
 *          {@link com.google.gwt.logging.client.JsonLogRecordClientUtil#logRecordAsJsonObject(LogRecord)}
 * @throws RemoteLoggingException if logging fails
 */
public static void logMessage(String logRecordJson) throws RemoteLoggingException {
    /*
     * if the header does not exist, we pass null, which is handled gracefully
     * by the deobfuscation code.
     */
    HttpServletRequest threadLocalRequest = RequestFactoryServlet.getThreadLocalRequest();
    String strongName = null;
    if (threadLocalRequest != null) {
        // can be null during tests
        strongName = threadLocalRequest.getHeader(RpcRequestBuilder.STRONG_NAME_HEADER);
    }
    RemoteLoggingServiceUtil.logOnServer(logRecordJson, strongName, deobfuscator, null);
}

From source file:com.googlecode.gwtphonegap.server.log.PhoneGapLogServiceStandardImpl.java

License:Apache License

@Override
public String logOnServer(String clientId, List<LogRecord> record) {
    String strongName = getPermutationStrongName();
    try {/* www .  j  a va 2  s  .c  om*/
        for (LogRecord logRecord : record) {
            if (clientId != null) {
                logRecord.setMessage("cid: '" + clientId + "' " + logRecord.getMessage());
            }

            RemoteLoggingServiceUtil.logOnServer(logRecord, strongName, deobfuscator, loggerNameOverride);
        }

    } catch (RemoteLoggingException e) {
        logger.log(Level.SEVERE, "Remote logging failed", e);
        return "Remote logging failed, check stack trace for details.";
    }
    return null;
}