summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-04-07 18:38:32 +0300
committerArtur Signell <artur@vaadin.com>2015-04-13 13:09:51 +0000
commit718eb3e49ad7fef3fca392989b246f38823a3018 (patch)
tree322e790ab427e4c538afefcb553ff0bb5c8064eb /client
parent4315226813f6bbfab5e5c6bcf05c5be5bdf9c198 (diff)
downloadvaadin-framework-718eb3e49ad7fef3fca392989b246f38823a3018.tar.gz
vaadin-framework-718eb3e49ad7fef3fca392989b246f38823a3018.zip
VConsole logging -> java.util.logging
Change-Id: Id1b04e1335f0906f8de2d514ff11bc744dc14c49
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConfiguration.java3
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java254
-rw-r--r--client/src/com/vaadin/client/ConnectorMap.java6
-rw-r--r--client/src/com/vaadin/client/DateTimeService.java27
-rw-r--r--client/src/com/vaadin/client/JavaScriptConnectorHelper.java18
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java70
-rw-r--r--client/src/com/vaadin/client/MeasuredSize.java11
-rw-r--r--client/src/com/vaadin/client/SuperDevMode.java26
-rw-r--r--client/src/com/vaadin/client/Util.java22
-rw-r--r--client/src/com/vaadin/client/VCaption.java9
-rw-r--r--client/src/com/vaadin/client/WidgetSet.java9
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java43
-rw-r--r--client/src/com/vaadin/client/communication/RpcManager.java7
-rw-r--r--client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java9
-rw-r--r--client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java8
15 files changed, 329 insertions, 193 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java
index 37d689c6d3..f4b2c93111 100644
--- a/client/src/com/vaadin/client/ApplicationConfiguration.java
+++ b/client/src/com/vaadin/client/ApplicationConfiguration.java
@@ -638,7 +638,8 @@ public class ApplicationConfiguration implements EntryPoint {
@Override
public void failed(Throwable reason) {
- VConsole.error(reason);
+ getLogger().log(Level.SEVERE,
+ "Error loading deferred bundle", reason);
}
});
}
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 1b3196e1c2..af86818fb3 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -26,6 +26,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.aria.client.LiveValue;
@@ -93,6 +94,7 @@ import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.dd.VDragAndDropManager;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.client.ui.window.WindowConnector;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.JsonConstants;
import com.vaadin.shared.VaadinUriResolver;
@@ -518,7 +520,7 @@ public class ApplicationConnection implements HasHandlers {
int currentTime = elapsedMillis();
int stepDuration = currentTime - previousStep;
if (stepDuration >= minDuration) {
- VConsole.log(message + ": " + stepDuration + " ms");
+ getLogger().info(message + ": " + stepDuration + " ms");
}
previousStep = currentTime;
}
@@ -540,16 +542,18 @@ public class ApplicationConnection implements HasHandlers {
}
public void init(WidgetSet widgetSet, ApplicationConfiguration cnf) {
- VConsole.log("Starting application " + cnf.getRootPanelId());
- VConsole.log("Using theme: " + cnf.getThemeName());
+ getLogger().info("Starting application " + cnf.getRootPanelId());
+ getLogger().info("Using theme: " + cnf.getThemeName());
- VConsole.log("Vaadin application servlet version: "
- + cnf.getServletVersion());
+ getLogger().info(
+ "Vaadin application servlet version: "
+ + cnf.getServletVersion());
if (!cnf.getServletVersion().equals(Version.getFullVersion())) {
- VConsole.error("Warning: your widget set seems to be built with a different "
- + "version than the one used on server. Unexpected "
- + "behavior may occur.");
+ getLogger()
+ .severe("Warning: your widget set seems to be built with a different "
+ + "version than the one used on server. Unexpected "
+ + "behavior may occur.");
}
this.widgetSet = widgetSet;
@@ -853,7 +857,8 @@ public class ApplicationConnection implements HasHandlers {
payload.put(ApplicationConstants.RPC_INVOCATIONS, reqInvocations);
payload.put(ApplicationConstants.SERVER_SYNC_ID, lastSeenServerSyncId);
- VConsole.log("Making UIDL Request with params: " + payload.toJson());
+ getLogger()
+ .info("Making UIDL Request with params: " + payload.toJson());
String uri = translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+ ApplicationConstants.UIDL_PATH + '/');
@@ -911,9 +916,10 @@ public class ApplicationConnection implements HasHandlers {
@Override
public void onResponseReceived(Request request, Response response) {
- VConsole.log("Server visit took "
- + String.valueOf((new Date()).getTime()
- - requestStartTime.getTime()) + "ms");
+ getLogger().info(
+ "Server visit took "
+ + String.valueOf((new Date()).getTime()
+ - requestStartTime.getTime()) + "ms");
int statusCode = response.getStatusCode();
// Notify network observers about response status
@@ -937,7 +943,7 @@ public class ApplicationConnection implements HasHandlers {
* Status code 0 does indicate that there was no server
* side processing, so we can retry the request.
*/
- VConsole.log("Status code 0, retrying");
+ getLogger().warning("Status code 0, retrying");
(new Timer() {
@Override
public void run() {
@@ -968,7 +974,8 @@ public class ApplicationConnection implements HasHandlers {
*/
String delay = response.getHeader("Retry-After");
if (delay != null) {
- VConsole.log("503, retrying in " + delay + "msec");
+ getLogger().warning(
+ "503, retrying in " + delay + "msec");
(new Timer() {
@Override
public void run() {
@@ -1026,7 +1033,7 @@ public class ApplicationConnection implements HasHandlers {
try {
doAjaxRequest(uri, payload, requestCallback);
} catch (RequestException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in server request", e);
endRequest();
fireEvent(new ConnectionStatusEvent(0));
}
@@ -1052,8 +1059,9 @@ public class ApplicationConnection implements HasHandlers {
return;
}
- VConsole.log("JSON parsing took "
- + (new Date().getTime() - start.getTime()) + "ms");
+ getLogger().info(
+ "JSON parsing took " + (new Date().getTime() - start.getTime())
+ + "ms");
if (isApplicationRunning()) {
handleReceivedJSONMessage(start, jsonText, json);
} else {
@@ -1192,9 +1200,10 @@ public class ApplicationConnection implements HasHandlers {
// Show this message just once
if (cssWaits++ == 0) {
- VConsole.log("Assuming CSS loading is not complete, "
- + "postponing render phase. "
- + "(.v-loading-indicator height == 0)");
+ getLogger().warning(
+ "Assuming CSS loading is not complete, "
+ + "postponing render phase. "
+ + "(.v-loading-indicator height == 0)");
}
} else {
cssLoaded = true;
@@ -1226,7 +1235,7 @@ public class ApplicationConnection implements HasHandlers {
*
*/
protected void showCommunicationError(String details, int statusCode) {
- VConsole.error("Communication error: " + details);
+ getLogger().severe("Communication error: " + details);
showError(details, configuration.getCommunicationError());
}
@@ -1237,7 +1246,7 @@ public class ApplicationConnection implements HasHandlers {
* Optional details for debugging.
*/
protected void showAuthenticationError(String details) {
- VConsole.error("Authentication error: " + details);
+ getLogger().severe("Authentication error: " + details);
showError(details, configuration.getAuthorizationError());
}
@@ -1248,7 +1257,7 @@ public class ApplicationConnection implements HasHandlers {
* Optional details for debugging.
*/
public void showSessionExpiredError(String details) {
- VConsole.error("Session expired: " + details);
+ getLogger().severe("Session expired: " + details);
showError(details, configuration.getSessionExpiredError());
}
@@ -1307,7 +1316,8 @@ public class ApplicationConnection implements HasHandlers {
protected void startRequest() {
if (hasActiveRequest) {
- VConsole.error("Trying to start a new request while another is active");
+ getLogger().severe(
+ "Trying to start a new request while another is active");
}
hasActiveRequest = true;
requestStartTime = new Date();
@@ -1316,7 +1326,7 @@ public class ApplicationConnection implements HasHandlers {
protected void endRequest() {
if (!hasActiveRequest) {
- VConsole.error("No active request");
+ getLogger().severe("No active request");
}
// After checkForPendingVariableBursts() there may be a new active
// request, so we must set hasActiveRequest to false before, not after,
@@ -1385,7 +1395,8 @@ public class ApplicationConnection implements HasHandlers {
&& !getConnectorMap().isDragAndDropPaintable(id)) {
// variable owner does not exist anymore
iterator.remove();
- VConsole.log("Removed variable from removed component: " + id);
+ getLogger().info(
+ "Removed variable from removed component: " + id);
}
}
}
@@ -1504,7 +1515,7 @@ public class ApplicationConnection implements HasHandlers {
// Some component is doing something that can't be interrupted
// (e.g. animation that should be smooth). Enqueue the UIDL
// message for later processing.
- VConsole.log("Postponing UIDL handling due to lock...");
+ getLogger().info("Postponing UIDL handling due to lock...");
pendingUIDLMessages.add(new PendingUIDLMessage(start, jsonText,
json));
if (!forceHandleMessage.isRunning()) {
@@ -1521,7 +1532,7 @@ public class ApplicationConnection implements HasHandlers {
final Object lock = new Object();
suspendReponseHandling(lock);
- VConsole.log("Handling message from server");
+ getLogger().info("Handling message from server");
eventBus.fireEvent(new ResponseHandlingStartedEvent(this));
final int syncId;
@@ -1540,14 +1551,15 @@ public class ApplicationConnection implements HasHandlers {
}
} else {
syncId = -1;
- VConsole.error("Server response didn't contain a sync id. "
- + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
+ getLogger()
+ .severe("Server response didn't contain a sync id. "
+ + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
}
// Handle redirect
if (json.containsKey("redirect")) {
String url = json.getValueMap("redirect").getString("url");
- VConsole.log("redirecting to " + url);
+ getLogger().info("redirecting to " + url);
redirect(url);
return;
}
@@ -1559,7 +1571,7 @@ public class ApplicationConnection implements HasHandlers {
csrfToken = json
.getString(ApplicationConstants.UIDL_SECURITY_TOKEN_ID);
}
- VConsole.log(" * Handling resources from server");
+ getLogger().info(" * Handling resources from server");
if (json.containsKey("resources")) {
ValueMap resources = json.getValueMap("resources");
@@ -1573,7 +1585,7 @@ public class ApplicationConnection implements HasHandlers {
handleUIDLDuration.logDuration(
" * Handling resources from server completed", 10);
- VConsole.log(" * Handling type inheritance map from server");
+ getLogger().info(" * Handling type inheritance map from server");
if (json.containsKey("typeInheritanceMap")) {
configuration.addComponentInheritanceInfo(json
@@ -1582,7 +1594,7 @@ public class ApplicationConnection implements HasHandlers {
handleUIDLDuration.logDuration(
" * Handling type inheritance map from server completed", 10);
- VConsole.log("Handling type mappings from server");
+ getLogger().info("Handling type mappings from server");
if (json.containsKey("typeMappings")) {
configuration.addComponentMappings(
@@ -1590,7 +1602,7 @@ public class ApplicationConnection implements HasHandlers {
}
- VConsole.log("Handling resource dependencies");
+ getLogger().info("Handling resource dependencies");
if (json.containsKey("scriptDependencies")) {
loadScriptDependencies(json.getJSStringArray("scriptDependencies"));
}
@@ -1620,7 +1632,7 @@ public class ApplicationConnection implements HasHandlers {
Profiler.enter("Handling meta information");
ValueMap meta = null;
if (json.containsKey("meta")) {
- VConsole.log(" * Handling meta information");
+ getLogger().info(" * Handling meta information");
meta = json.getValueMap("meta");
if (meta.containsKey("repaintAll")) {
prepareRepaintAll();
@@ -1663,7 +1675,7 @@ public class ApplicationConnection implements HasHandlers {
* connectors which get a state change event before the UI.
*/
Profiler.enter("Handling locales");
- VConsole.log(" * Handling locales");
+ getLogger().info(" * Handling locales");
// Store locale data
LocaleService
.addLocales(getUIConnector().getState().localeServiceState.localeData);
@@ -1697,9 +1709,10 @@ public class ApplicationConnection implements HasHandlers {
unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
- VConsole.log("handleUIDLMessage: "
- + (Duration.currentTimeMillis() - processUidlStart)
- + " ms");
+ getLogger()
+ .info("handleUIDLMessage: "
+ + (Duration.currentTimeMillis() - processUidlStart)
+ + " ms");
updatingState = false;
@@ -1710,14 +1723,15 @@ public class ApplicationConnection implements HasHandlers {
layoutManager.setEverythingNeedsMeasure();
layoutManager.layoutNow();
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error processing layouts", e);
}
Profiler.leave("Layout processing");
}
if (ApplicationConfiguration.isDebugMode()) {
Profiler.enter("Dumping state changes to the console");
- VConsole.log(" * Dumping state changes to the console");
+ getLogger().info(" * Dumping state changes to the console");
VConsole.dirUIDL(json, ApplicationConnection.this);
Profiler.leave("Dumping state changes to the console");
}
@@ -1748,10 +1762,13 @@ public class ApplicationConnection implements HasHandlers {
}
}
- VConsole.log(" Processing time was "
- + String.valueOf(lastProcessingTime) + "ms for "
- + jsonText.length() + " characters of JSON");
- VConsole.log("Referenced paintables: " + connectorMap.size());
+ getLogger().info(
+ " Processing time was "
+ + String.valueOf(lastProcessingTime)
+ + "ms for " + jsonText.length()
+ + " characters of JSON");
+ getLogger().info(
+ "Referenced paintables: " + connectorMap.size());
if (meta == null || !meta.containsKey("async")) {
// End the request if the received message was a response,
@@ -1854,7 +1871,7 @@ public class ApplicationConnection implements HasHandlers {
JsArrayObject<StateChangeEvent> pendingStateChangeEvents) {
Profiler.enter("@DelegateToWidget");
- VConsole.log(" * Running @DelegateToWidget");
+ getLogger().info(" * Running @DelegateToWidget");
// Keep track of types that have no @DelegateToWidget in their
// state to optimize performance
@@ -1938,7 +1955,7 @@ public class ApplicationConnection implements HasHandlers {
private void sendStateChangeEvents(
JsArrayObject<StateChangeEvent> pendingStateChangeEvents) {
Profiler.enter("sendStateChangeEvents");
- VConsole.log(" * Sending state change events");
+ getLogger().info(" * Sending state change events");
int size = pendingStateChangeEvents.size();
for (int i = 0; i < size; i++) {
@@ -1946,7 +1963,8 @@ public class ApplicationConnection implements HasHandlers {
try {
sce.getConnector().fireEvent(sce);
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error sending state change events", e);
}
}
@@ -1963,11 +1981,12 @@ public class ApplicationConnection implements HasHandlers {
ServerConnector c = currentConnectors.get(i);
if (c.getParent() != null) {
if (!c.getParent().getChildren().contains(c)) {
- VConsole.error("ERROR: Connector "
- + c.getConnectorId()
- + " is connected to a parent but the parent ("
- + c.getParent().getConnectorId()
- + ") does not contain the connector");
+ getLogger()
+ .severe("ERROR: Connector "
+ + c.getConnectorId()
+ + " is connected to a parent but the parent ("
+ + c.getParent().getConnectorId()
+ + ") does not contain the connector");
}
} else if (c == getUIConnector()) {
// UIConnector for this connection, ignore
@@ -1978,9 +1997,10 @@ public class ApplicationConnection implements HasHandlers {
} else {
// The connector has been detached from the
// hierarchy but was not unregistered.
- VConsole.error("ERROR: Connector "
- + c.getConnectorId()
- + " is not attached to a parent but has not been unregistered");
+ getLogger()
+ .severe("ERROR: Connector "
+ + c.getConnectorId()
+ + " is not attached to a parent but has not been unregistered");
}
}
@@ -2008,13 +2028,14 @@ public class ApplicationConnection implements HasHandlers {
verifyConnectorHierarchy();
}
- VConsole.log("* Unregistered " + detachedArray.length()
- + " connectors");
+ getLogger().info(
+ "* Unregistered " + detachedArray.length()
+ + " connectors");
Profiler.leave("unregisterRemovedConnectors");
}
private JsArrayString createConnectorsIfNeeded(ValueMap json) {
- VConsole.log(" * Creating connectors (if needed)");
+ getLogger().info(" * Creating connectors (if needed)");
JsArrayString createdConnectors = JavaScriptObject
.createArray().cast();
@@ -2065,7 +2086,8 @@ public class ApplicationConnection implements HasHandlers {
createdConnectors.push(connectorId);
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error handling type data", e);
}
}
@@ -2085,7 +2107,8 @@ public class ApplicationConnection implements HasHandlers {
onlyNoLayoutUpdates = false;
}
- VConsole.log(" * Passing UIDL to Vaadin 6 style connectors");
+ getLogger()
+ .info(" * Passing UIDL to Vaadin 6 style connectors");
// update paintables
for (int i = 0; i < length; i++) {
try {
@@ -2111,18 +2134,20 @@ public class ApplicationConnection implements HasHandlers {
Profiler.leave(key);
}
} else if (legacyConnector == null) {
- VConsole.error("Received update for "
- + uidl.getTag()
- + ", but there is no such paintable ("
- + connectorId + ") rendered.");
+ getLogger()
+ .severe("Received update for "
+ + uidl.getTag()
+ + ", but there is no such paintable ("
+ + connectorId + ") rendered.");
} else {
- VConsole.error("Server sent Vaadin 6 style updates for "
- + Util.getConnectorString(legacyConnector)
- + " but this is not a Vaadin 6 Paintable");
+ getLogger()
+ .severe("Server sent Vaadin 6 style updates for "
+ + Util.getConnectorString(legacyConnector)
+ + " but this is not a Vaadin 6 Paintable");
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error handling UIDL", e);
}
}
@@ -2137,14 +2162,15 @@ public class ApplicationConnection implements HasHandlers {
}
Profiler.enter("sendHierarchyChangeEvents");
- VConsole.log(" * Sending hierarchy change events");
+ getLogger().info(" * Sending hierarchy change events");
for (int i = 0; i < eventCount; i++) {
ConnectorHierarchyChangeEvent event = events.get(i);
try {
logHierarchyChange(event);
event.getConnector().fireEvent(event);
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error sending hierarchy change events", e);
}
}
@@ -2157,13 +2183,14 @@ public class ApplicationConnection implements HasHandlers {
return;
}
- VConsole.log("Hierarchy changed for "
- + Util.getConnectorString(event.getConnector()));
+ getLogger()
+ .info("Hierarchy changed for "
+ + Util.getConnectorString(event.getConnector()));
String oldChildren = "* Old children: ";
for (ComponentConnector child : event.getOldChildren()) {
oldChildren += Util.getConnectorString(child) + " ";
}
- VConsole.log(oldChildren);
+ getLogger().info(oldChildren);
String newChildren = "* New children: ";
HasComponentsConnector parent = (HasComponentsConnector) event
@@ -2171,14 +2198,14 @@ public class ApplicationConnection implements HasHandlers {
for (ComponentConnector child : parent.getChildComponents()) {
newChildren += Util.getConnectorString(child) + " ";
}
- VConsole.log(newChildren);
+ getLogger().info(newChildren);
}
private JsArrayObject<StateChangeEvent> updateConnectorState(
ValueMap json, JsArrayString createdConnectorIds) {
JsArrayObject<StateChangeEvent> events = JavaScriptObject
.createArray().cast();
- VConsole.log(" * Updating connector states");
+ getLogger().info(" * Updating connector states");
if (!json.containsKey("state")) {
return events;
}
@@ -2256,7 +2283,8 @@ public class ApplicationConnection implements HasHandlers {
Profiler.leave("updateConnectorState inner loop");
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error updating connector states", e);
}
}
@@ -2298,7 +2326,7 @@ public class ApplicationConnection implements HasHandlers {
ValueMap json) {
ConnectorHierarchyUpdateResult result = new ConnectorHierarchyUpdateResult();
- VConsole.log(" * Updating connector hierarchy");
+ getLogger().info(" * Updating connector hierarchy");
if (!json.containsKey("hierarchy")) {
return result;
}
@@ -2330,16 +2358,18 @@ public class ApplicationConnection implements HasHandlers {
ServerConnector childConnector = connectorMap
.getConnector(childConnectorId);
if (childConnector == null) {
- VConsole.error("Hierarchy claims that "
- + childConnectorId
- + " is a child for "
- + connectorId
- + " ("
- + parentConnector.getClass().getName()
- + ") but no connector with id "
- + childConnectorId
- + " has been registered. "
- + "More information might be available in the server-side log if assertions are enabled");
+ getLogger()
+ .severe("Hierarchy claims that "
+ + childConnectorId
+ + " is a child for "
+ + connectorId
+ + " ("
+ + parentConnector.getClass()
+ .getName()
+ + ") but no connector with id "
+ + childConnectorId
+ + " has been registered. "
+ + "More information might be available in the server-side log if assertions are enabled");
continue;
}
newChildren.add(childConnector);
@@ -2392,9 +2422,10 @@ public class ApplicationConnection implements HasHandlers {
result.events.add(event);
}
} else if (!newComponents.isEmpty()) {
- VConsole.error("Hierachy claims "
- + Util.getConnectorString(parentConnector)
- + " has component children even though it isn't a HasComponentsConnector");
+ getLogger()
+ .severe("Hierachy claims "
+ + Util.getConnectorString(parentConnector)
+ + " has component children even though it isn't a HasComponentsConnector");
}
Profiler.leave("updateConnectorHierarchy handle HasComponentsConnector");
@@ -2428,7 +2459,8 @@ public class ApplicationConnection implements HasHandlers {
Profiler.leave("updateConnectorHierarchy find removed children");
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error updating connector hierarchy", e);
} finally {
Profiler.leave("updateConnectorHierarchy hierarchy entry");
}
@@ -2575,7 +2607,8 @@ public class ApplicationConnection implements HasHandlers {
if (json.containsKey("rpc")) {
Profiler.enter("handleRpcInvocations");
- VConsole.log(" * Performing server to client RPC calls");
+ getLogger()
+ .info(" * Performing server to client RPC calls");
JsonArray rpcCalls = Util.jso2json(json
.getJavaScriptObject("rpc"));
@@ -2595,7 +2628,10 @@ public class ApplicationConnection implements HasHandlers {
}
} catch (final Throwable e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error performing server to client RPC calls",
+ e);
}
}
@@ -2617,8 +2653,9 @@ public class ApplicationConnection implements HasHandlers {
@Override
public void onError(ResourceLoadEvent event) {
- VConsole.error(event.getResourceUrl()
- + " could not be loaded, or the load detection failed because the stylesheet is empty.");
+ getLogger()
+ .severe(event.getResourceUrl()
+ + " could not be loaded, or the load detection failed because the stylesheet is empty.");
// The show must go on
onLoad(event);
}
@@ -2652,7 +2689,8 @@ public class ApplicationConnection implements HasHandlers {
@Override
public void onError(ResourceLoadEvent event) {
- VConsole.error(event.getResourceUrl() + " could not be loaded.");
+ getLogger().severe(
+ event.getResourceUrl() + " could not be loaded.");
// The show must go on
onLoad(event);
}
@@ -3143,7 +3181,7 @@ public class ApplicationConnection implements HasHandlers {
layoutManager.forceLayout();
- VConsole.log("forceLayout in " + duration.elapsedMillis() + " ms");
+ getLogger().info("forceLayout in " + duration.elapsedMillis() + " ms");
}
/**
@@ -3419,8 +3457,9 @@ public class ApplicationConnection implements HasHandlers {
*/
@Deprecated
public void unregisterPaintable(ServerConnector p) {
- VConsole.log("unregisterPaintable (unnecessarily) called for "
- + Util.getConnectorString(p));
+ getLogger().info(
+ "unregisterPaintable (unnecessarily) called for "
+ + Util.getConnectorString(p));
}
/**
@@ -3454,8 +3493,10 @@ public class ApplicationConnection implements HasHandlers {
}
if (!manageCaption) {
- VConsole.error(Util.getConnectorString(connector)
- + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
+ getLogger()
+ .warning(
+ Util.getConnectorString(connector)
+ + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
}
return false;
}
@@ -3517,7 +3558,9 @@ public class ApplicationConnection implements HasHandlers {
Timer forceHandleMessage = new Timer() {
@Override
public void run() {
- VConsole.log("WARNING: reponse handling was never resumed, forcibly removing locks...");
+ getLogger()
+ .warning(
+ "WARNING: reponse handling was never resumed, forcibly removing locks...");
responseHandlingLocks.clear();
handlePendingMessages();
}
@@ -3545,7 +3588,8 @@ public class ApplicationConnection implements HasHandlers {
forceHandleMessage.cancel();
if (!pendingUIDLMessages.isEmpty()) {
- VConsole.log("No more response handling locks, handling pending requests.");
+ getLogger()
+ .info("No more response handling locks, handling pending requests.");
handlePendingMessages();
}
}
diff --git a/client/src/com/vaadin/client/ConnectorMap.java b/client/src/com/vaadin/client/ConnectorMap.java
index 1211eb2684..3200dd6ab4 100644
--- a/client/src/com/vaadin/client/ConnectorMap.java
+++ b/client/src/com/vaadin/client/ConnectorMap.java
@@ -17,6 +17,7 @@ package com.vaadin.client;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.logging.Logger;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
@@ -182,7 +183,7 @@ public class ConnectorMap {
*/
public void unregisterConnector(ServerConnector connector) {
if (connector == null) {
- VConsole.error("Trying to unregister null connector");
+ getLogger().severe("Trying to unregister null connector");
return;
}
@@ -299,4 +300,7 @@ public class ConnectorMap {
return getConnectorId(w.getElement()) != null;
}
+ private static Logger getLogger() {
+ return Logger.getLogger(ConnectorMap.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/DateTimeService.java b/client/src/com/vaadin/client/DateTimeService.java
index f4cfe7a278..56116377cf 100644
--- a/client/src/com/vaadin/client/DateTimeService.java
+++ b/client/src/com/vaadin/client/DateTimeService.java
@@ -17,6 +17,8 @@
package com.vaadin.client;
import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.LocaleInfo;
@@ -71,7 +73,7 @@ public class DateTimeService {
try {
return LocaleService.getMonthNames(currentLocale)[month];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getMonth", e);
return null;
}
}
@@ -80,7 +82,7 @@ public class DateTimeService {
try {
return LocaleService.getShortMonthNames(currentLocale)[month];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getShortMonth", e);
return null;
}
}
@@ -89,7 +91,7 @@ public class DateTimeService {
try {
return LocaleService.getDayNames(currentLocale)[day];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getDay", e);
return null;
}
}
@@ -98,7 +100,7 @@ public class DateTimeService {
try {
return LocaleService.getShortDayNames(currentLocale)[day];
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getShortDay", e);
return null;
}
}
@@ -107,7 +109,7 @@ public class DateTimeService {
try {
return LocaleService.getFirstDayOfWeek(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getFirstDayOfWeek", e);
return 0;
}
}
@@ -116,7 +118,7 @@ public class DateTimeService {
try {
return LocaleService.isTwelveHourClock(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in isTwelveHourClock", e);
return false;
}
}
@@ -125,7 +127,7 @@ public class DateTimeService {
try {
return LocaleService.getClockDelimiter(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error in getClockDelimiter", e);
return ":";
}
}
@@ -137,8 +139,8 @@ public class DateTimeService {
return LocaleService.getAmPmStrings(currentLocale);
} catch (final LocaleNotLoadedException e) {
// TODO can this practically even happen? Should die instead?
- VConsole.error("Locale not loaded, using fallback : AM/PM");
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Locale not loaded, using fallback : AM/PM", e);
return DEFAULT_AMPM_STRINGS;
}
}
@@ -150,8 +152,8 @@ public class DateTimeService {
try {
firstDay = LocaleService.getFirstDayOfWeek(currentLocale);
} catch (final LocaleNotLoadedException e) {
- VConsole.error("Locale not loaded, using fallback 0");
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Locale not loaded, using fallback 0", e);
firstDay = 0;
}
int start = dateForFirstOfThisMonth.getDay() - firstDay;
@@ -496,4 +498,7 @@ public class DateTimeService {
}
+ public static Logger getLogger() {
+ return Logger.getLogger(DateTimeService.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
index 1eb326115e..d992acd8b8 100644
--- a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
+++ b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.logging.Logger;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
@@ -158,18 +159,21 @@ public class JavaScriptConnectorHelper {
String initFunctionName = serverSideClassName
.replaceAll("\\.", "_");
if (tryInitJs(initFunctionName, getConnectorWrapper())) {
- VConsole.log("JavaScript connector initialized using "
- + initFunctionName);
+ getLogger().info(
+ "JavaScript connector initialized using "
+ + initFunctionName);
this.initFunctionName = initFunctionName;
return true;
} else {
- VConsole.log("No JavaScript function " + initFunctionName
- + " found");
+ getLogger()
+ .warning(
+ "No JavaScript function " + initFunctionName
+ + " found");
attemptedNames.add(initFunctionName);
tag = conf.getParentTag(tag.intValue());
}
}
- VConsole.log("No JavaScript init for connector not found");
+ getLogger().info("No JavaScript init for connector found");
showInitProblem(attemptedNames);
return false;
}
@@ -497,4 +501,8 @@ public class JavaScriptConnectorHelper {
public String getInitFunctionName() {
return initFunctionName;
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(JavaScriptConnectorHelper.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index 828f0942b7..3f189bcea8 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -20,6 +20,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.core.client.Duration;
@@ -232,8 +233,9 @@ public class LayoutManager {
}
layoutCounts.put(layout.getConnectorId(), count);
if (count.intValue() > 2) {
- VConsole.error(Util.getConnectorString(layout)
- + " has been layouted " + count.intValue() + " times");
+ getLogger().severe(
+ Util.getConnectorString(layout) + " has been layouted "
+ + count.intValue() + " times");
}
}
@@ -281,7 +283,7 @@ public class LayoutManager {
}
private void doLayout() {
- VConsole.log("Starting layout phase");
+ getLogger().info("Starting layout phase");
Profiler.enter("LayoutManager phase init");
FastStringMap<Integer> layoutCounts = FastStringMap.create();
@@ -335,7 +337,7 @@ public class LayoutManager {
everythingNeedsMeasure = false;
if (measuredConnectorCount == 0) {
- VConsole.log("No more changes in pass " + passes);
+ getLogger().info("No more changes in pass " + passes);
Profiler.leave("Layout pass");
break;
}
@@ -373,7 +375,8 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error in resize listener", e);
}
}
Profiler.leave("Layout fire resize events - listeners not null");
@@ -417,7 +420,8 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE,
+ "Error in ManagedLayout handling", e);
}
countLayout(layoutCounts, cl);
} else {
@@ -440,7 +444,11 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in SimpleManagedLayout (horizontal) handling",
+ e);
+
}
countLayout(layoutCounts, rr);
}
@@ -473,7 +481,10 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in DirectionalManagedLayout handling",
+ e);
}
countLayout(layoutCounts, cl);
} else {
@@ -496,7 +507,10 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
- VConsole.error(e);
+ getLogger()
+ .log(Level.SEVERE,
+ "Error in SimpleManagedLayout (vertical) handling",
+ e);
}
countLayout(layoutCounts, rr);
}
@@ -531,18 +545,19 @@ public class LayoutManager {
b.append(connectorString);
}
}
- VConsole.log(b.toString());
+ getLogger().info(b.toString());
}
Profiler.leave("Layout pass");
- VConsole.log("Pass " + passes + " measured "
- + measuredConnectorCount + " elements, fired "
- + firedListeners + " listeners and did " + layoutCount
- + " layouts.");
+ getLogger()
+ .info("Pass " + passes + " measured "
+ + measuredConnectorCount + " elements, fired "
+ + firedListeners + " listeners and did "
+ + layoutCount + " layouts.");
if (passes > 100) {
- VConsole.log(LOOP_ABORT_MESSAGE);
+ getLogger().severe(LOOP_ABORT_MESSAGE);
if (ApplicationConfiguration.isDebugMode()) {
VNotification.createNotification(
VNotification.DELAY_FOREVER,
@@ -579,8 +594,9 @@ public class LayoutManager {
cleanMeasuredSizes();
- VConsole.log("Total layout phase time: "
- + totalDuration.elapsedMillis() + "ms");
+ getLogger().info(
+ "Total layout phase time: " + totalDuration.elapsedMillis()
+ + "ms");
}
private void logConnectorStatus(int connectorId) {
@@ -614,11 +630,12 @@ public class LayoutManager {
}
if (debugLogging) {
- VConsole.log("Doing overflow fix for "
- + Util.getConnectorString(componentConnector)
- + " in "
- + Util.getConnectorString(componentConnector
- .getParent()));
+ getLogger()
+ .info("Doing overflow fix for "
+ + Util.getConnectorString(componentConnector)
+ + " in "
+ + Util.getConnectorString(componentConnector
+ .getParent()));
}
Profiler.enter("Overflow fix apply");
@@ -669,8 +686,8 @@ public class LayoutManager {
Profiler.leave("Overflow fix restore");
if (!pendingOverflowFixes.isEmpty()) {
- VConsole.log("Did overflow fix for " + remainingCount
- + " elements");
+ getLogger().info(
+ "Did overflow fix for " + remainingCount + " elements");
}
pendingOverflowFixes = delayedOverflowFixes;
}
@@ -794,8 +811,9 @@ public class LayoutManager {
measuredAndUpdate(element, getMeasuredSize(element, null));
}
Profiler.leave("LayoutManager.measureNonConenctors");
- VConsole.log("Measured " + measuredNonConnectorElements.size()
- + " non connector elements");
+ getLogger().info(
+ "Measured " + measuredNonConnectorElements.size()
+ + " non connector elements");
}
private MeasureResult measuredAndUpdate(Element element,
diff --git a/client/src/com/vaadin/client/MeasuredSize.java b/client/src/com/vaadin/client/MeasuredSize.java
index 8520635a4d..eeedff561f 100644
--- a/client/src/com/vaadin/client/MeasuredSize.java
+++ b/client/src/com/vaadin/client/MeasuredSize.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
@@ -276,8 +278,9 @@ public class MeasuredSize {
private void debugSizeChange(Element element, String sizeChangeType,
String changedFrom, String changedTo) {
if (debugSizeChanges) {
- VConsole.log(sizeChangeType + " has changed from " + changedFrom
- + " to " + changedTo + " for " + element.toString());
+ getLogger()
+ .info(sizeChangeType + " has changed from " + changedFrom
+ + " to " + changedTo + " for " + element.toString());
}
}
@@ -289,4 +292,8 @@ public class MeasuredSize {
return sizes1[0] != sizes2[0] || sizes1[2] != sizes2[2];
}
+ public static Logger getLogger() {
+ return Logger.getLogger(MeasuredSize.class.getName());
+ }
+
}
diff --git a/client/src/com/vaadin/client/SuperDevMode.java b/client/src/com/vaadin/client/SuperDevMode.java
index 821af6075a..7bd759a490 100644
--- a/client/src/com/vaadin/client/SuperDevMode.java
+++ b/client/src/com/vaadin/client/SuperDevMode.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.http.client.UrlBuilder;
@@ -51,8 +53,9 @@ public class SuperDevMode {
private static void recompileWidgetsetAndStartInDevMode(
final String serverUrl) {
- VConsole.log("Recompiling widgetset using<br/>" + serverUrl
- + "<br/>and then reloading in super dev mode");
+ getLogger().info(
+ "Recompiling widgetset using<br/>" + serverUrl
+ + "<br/>and then reloading in super dev mode");
VNotification n = new VNotification();
n.show("<b>Recompiling widgetset, please wait</b>",
VNotification.CENTERED, VNotification.STYLE_SYSTEM);
@@ -66,10 +69,10 @@ public class SuperDevMode {
@Override
public void onSuccess(RecompileResult result) {
- VConsole.log("JSONP compile call successful");
+ getLogger().fine("JSONP compile call successful");
if (!result.ok()) {
- VConsole.log("* result: " + result);
+ getLogger().fine("* result: " + result);
failed();
return;
}
@@ -80,17 +83,18 @@ public class SuperDevMode {
serverUrl));
setSession(SKIP_RECOMPILE, "1");
- VConsole.log("* result: OK. Reloading");
+ getLogger().fine("* result: OK. Reloading");
Location.reload();
}
@Override
public void onFailure(Throwable caught) {
- VConsole.error("JSONP compile call failed");
+ getLogger().severe("JSONP compile call failed");
// Don't log exception as they are shown as
// notifications
- VConsole.error(caught.getClass().getSimpleName() + ": "
- + caught.getMessage());
+ getLogger().severe(
+ caught.getClass().getSimpleName() + ": "
+ + caught.getMessage());
failed();
}
@@ -189,7 +193,7 @@ public class SuperDevMode {
}
if (hasSession(SKIP_RECOMPILE)) {
- VConsole.log("Running in SuperDevMode");
+ getLogger().info("Running in SuperDevMode");
// When we get here, we are running in super dev mode
// Remove the flag so next reload will recompile
@@ -260,4 +264,8 @@ public class SuperDevMode {
VNotification n = new VNotification();
n.show(message, VNotification.CENTERED_TOP, VNotification.STYLE_SYSTEM);
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(SuperDevMode.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index 99e6507d81..e8fbd8855b 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -21,6 +21,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
@@ -593,10 +595,11 @@ public class Util {
ApplicationConnection c) {
ServerConnector connector = ConnectorMap.get(c).getConnector(id);
if (connector != null) {
- VConsole.log("\t" + id + " (" + connector.getClass() + ") :");
+ getLogger().info("\t" + id + " (" + connector.getClass() + ") :");
} else {
- VConsole.log("\t" + id
- + ": Warning: no corresponding connector for id " + id);
+ getLogger().warning(
+ "\t" + id + ": Warning: no corresponding connector for id "
+ + id);
}
for (MethodInvocation invocation : invocations) {
Object[] parameters = invocation.getParameters();
@@ -615,15 +618,17 @@ public class Util {
formattedParams = (null != parameters) ? Arrays
.toString(parameters) : null;
}
- VConsole.log("\t\t" + invocation.getInterfaceName() + "."
- + invocation.getMethodName() + "(" + formattedParams + ")");
+ getLogger().info(
+ "\t\t" + invocation.getInterfaceName() + "."
+ + invocation.getMethodName() + "("
+ + formattedParams + ")");
}
}
static void logVariableBurst(ApplicationConnection c,
Collection<MethodInvocation> loggedBurst) {
try {
- VConsole.log("Variable burst to be sent to server:");
+ getLogger().info("Variable burst to be sent to server:");
String curId = null;
ArrayList<MethodInvocation> invocations = new ArrayList<MethodInvocation>();
for (MethodInvocation methodInvocation : loggedBurst) {
@@ -642,7 +647,7 @@ public class Util {
printConnectorInvocations(invocations, curId, c);
}
} catch (Exception e) {
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Error sending variable burst", e);
}
}
@@ -959,4 +964,7 @@ public class Util {
return JSON.parse(jsonAsString);
}-*/;
+ public static Logger getLogger() {
+ return Logger.getLogger(Util.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index 050edae8be..47c9309b39 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -16,6 +16,8 @@
package com.vaadin.client;
+import java.util.logging.Logger;
+
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Unit;
@@ -445,7 +447,9 @@ public class VCaption extends HTML {
if (owner != null) {
Util.notifyParentOfSizeChange(owner.getWidget(), true);
} else {
- VConsole.log("Warning: Icon load event was not propagated because VCaption owner is unknown.");
+ getLogger()
+ .warning(
+ "Warning: Icon load event was not propagated because VCaption owner is unknown.");
}
}
}
@@ -766,4 +770,7 @@ public class VCaption extends HTML {
}
+ public static Logger getLogger() {
+ return Logger.getLogger(VCaption.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/WidgetSet.java b/client/src/com/vaadin/client/WidgetSet.java
index eff98a146a..797047367f 100644
--- a/client/src/com/vaadin/client/WidgetSet.java
+++ b/client/src/com/vaadin/client/WidgetSet.java
@@ -16,6 +16,9 @@
package com.vaadin.client;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import com.google.gwt.core.client.GWT;
import com.vaadin.client.communication.HasJavaScriptConnectorHelper;
import com.vaadin.client.metadata.BundleLoadCallback;
@@ -132,11 +135,15 @@ public class WidgetSet {
@Override
public void failed(Throwable reason) {
- VConsole.error(reason);
+ getLogger().log(Level.SEVERE, "Error loading bundle",
+ reason);
ApplicationConfiguration.endDependencyLoading();
}
});
}
}
+ public static Logger getLogger() {
+ return Logger.getLogger(WidgetSet.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index cd989d7ea4..e453ee7fcf 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -17,6 +17,7 @@
package com.vaadin.client.communication;
import java.util.ArrayList;
+import java.util.logging.Logger;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler;
@@ -30,7 +31,6 @@ import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler;
import com.vaadin.client.ResourceLoader;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
-import com.vaadin.client.VConsole;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.Version;
import com.vaadin.shared.communication.PushConstants;
@@ -210,7 +210,7 @@ public class AtmospherePushConnection implements PushConnection {
// uri is needed to identify the right connection when closing
uri = SharedUtil.addGetParameters(baseUrl, extraParams);
- VConsole.log("Establishing push connection");
+ getLogger().info("Establishing push connection");
socket = doConnect(uri, getConfig());
}
@@ -230,12 +230,12 @@ public class AtmospherePushConnection implements PushConnection {
switch (state) {
case CONNECT_PENDING:
assert isActive();
- VConsole.log("Queuing push message: " + message.toJson());
+ getLogger().info("Queuing push message: " + message.toJson());
messageQueue.add(message);
break;
case CONNECTED:
assert isActive();
- VConsole.log("Sending push message: " + message.toJson());
+ getLogger().info("Sending push message: " + message.toJson());
if (transport.equals("websocket")) {
FragmentedMessage fragmented = new FragmentedMessage(
@@ -258,14 +258,15 @@ public class AtmospherePushConnection implements PushConnection {
}
protected void onReopen(AtmosphereResponse response) {
- VConsole.log("Push connection re-established using "
- + response.getTransport());
+ getLogger().info(
+ "Push connection re-established using "
+ + response.getTransport());
onConnect(response);
}
protected void onOpen(AtmosphereResponse response) {
- VConsole.log("Push connection established using "
- + response.getTransport());
+ getLogger().info(
+ "Push connection established using " + response.getTransport());
onConnect(response);
}
@@ -321,7 +322,7 @@ public class AtmospherePushConnection implements PushConnection {
break;
case CONNECTED:
// Normal disconnect
- VConsole.log("Closing push connection");
+ getLogger().info("Closing push connection");
doDisconnect(uri);
state = State.DISCONNECTED;
command.execute();
@@ -335,7 +336,7 @@ public class AtmospherePushConnection implements PushConnection {
protected void onMessage(AtmosphereResponse response) {
String message = response.getResponseBody();
if (message.startsWith("for(;;);")) {
- VConsole.log("Received push message: " + message);
+ getLogger().info("Received push message: " + message);
// "for(;;);[{json}]" -> "{json}"
message = message.substring(9, message.length() - 1);
connection.handlePushMessage(message);
@@ -347,9 +348,10 @@ public class AtmospherePushConnection implements PushConnection {
* tried
*/
protected void onTransportFailure() {
- VConsole.log("Push connection using primary method ("
- + getConfig().getTransport() + ") failed. Trying with "
- + getConfig().getFallbackTransport());
+ getLogger().warning(
+ "Push connection using primary method ("
+ + getConfig().getTransport() + ") failed. Trying with "
+ + getConfig().getFallbackTransport());
}
/**
@@ -365,7 +367,7 @@ public class AtmospherePushConnection implements PushConnection {
}
protected void onClose(AtmosphereResponse response) {
- VConsole.log("Push connection closed");
+ getLogger().info("Push connection closed");
state = State.CONNECT_PENDING;
}
@@ -380,10 +382,11 @@ public class AtmospherePushConnection implements PushConnection {
protected void onReconnect(JavaScriptObject request,
final AtmosphereResponse response) {
if (state == State.CONNECTED) {
- VConsole.log("No onClose was received before reconnect. Forcing state to closed.");
+ getLogger()
+ .fine("No onClose was received before reconnect. Forcing state to closed.");
state = State.CONNECT_PENDING;
}
- VConsole.log("Reopening push connection");
+ getLogger().info("Reopening push connection");
}
public static abstract class AbstractJSO extends JavaScriptObject {
@@ -535,14 +538,14 @@ public class AtmospherePushConnection implements PushConnection {
} else {
final String pushJs = getVersionedPushJs();
- VConsole.log("Loading " + pushJs);
+ getLogger().info("Loading " + pushJs);
ResourceLoader.get().loadScript(
connection.getConfiguration().getVaadinDirUrl() + pushJs,
new ResourceLoadListener() {
@Override
public void onLoad(ResourceLoadEvent event) {
if (isAtmosphereLoaded()) {
- VConsole.log(pushJs + " loaded");
+ getLogger().info(pushJs + " loaded");
command.execute();
} else {
// If bootstrap tried to load vaadinPush.js,
@@ -584,4 +587,8 @@ public class AtmospherePushConnection implements PushConnection {
public String getTransportType() {
return transport;
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(AtmospherePushConnection.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/communication/RpcManager.java b/client/src/com/vaadin/client/communication/RpcManager.java
index f5c3ca9ffb..83dd6b15bd 100644
--- a/client/src/com/vaadin/client/communication/RpcManager.java
+++ b/client/src/com/vaadin/client/communication/RpcManager.java
@@ -17,11 +17,11 @@
package com.vaadin.client.communication;
import java.util.Collection;
+import java.util.logging.Logger;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ConnectorMap;
import com.vaadin.client.ServerConnector;
-import com.vaadin.client.VConsole;
import com.vaadin.client.metadata.Method;
import com.vaadin.client.metadata.NoDataException;
import com.vaadin.client.metadata.Type;
@@ -122,7 +122,7 @@ public class RpcManager {
}
parseMethodParameters(invocation, parametersJson, connection);
- VConsole.log("Server to client RPC call: " + invocation);
+ getLogger().info("Server to client RPC call: " + invocation);
applyInvocation(invocation, connector);
}
@@ -142,4 +142,7 @@ public class RpcManager {
methodInvocation.setParameters(parameters);
}
+ public static Logger getLogger() {
+ return Logger.getLogger(RpcManager.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java b/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
index 0856bb3575..d26a0ee076 100644
--- a/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
+++ b/client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
@@ -18,13 +18,14 @@ package com.vaadin.client.debug.internal;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.JsArrayObject;
import com.vaadin.client.ServerConnector;
-import com.vaadin.client.VConsole;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.metadata.NoDataException;
import com.vaadin.client.metadata.Property;
@@ -84,7 +85,7 @@ public class ConnectorInfoPanel extends FlowPanel {
}
} catch (NoDataException e) {
html += "<div>Could not read state, error has been logged to the console</div>";
- VConsole.error(e);
+ getLogger().log(Level.SEVERE, "Could not read state", e);
}
clear();
@@ -105,4 +106,8 @@ public class ConnectorInfoPanel extends FlowPanel {
public void clearContents() {
clear();
}
+
+ public static Logger getLogger() {
+ return Logger.getLogger(ConnectorInfoPanel.class.getName());
+ }
}
diff --git a/client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java b/client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java
index e2b1f928de..5134ed3b27 100644
--- a/client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java
+++ b/client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java
@@ -17,6 +17,7 @@ package com.vaadin.client.debug.internal;
import java.util.HashSet;
import java.util.Set;
+import java.util.logging.Logger;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
@@ -24,7 +25,6 @@ import com.vaadin.client.ApplicationConfiguration;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.Util;
-import com.vaadin.client.VConsole;
import com.vaadin.client.ui.UnknownComponentConnector;
/**
@@ -95,7 +95,8 @@ public class OptimizedWidgetsetPanel extends FlowPanel {
tag++;
if (tag > 10000) {
// Sanity check
- VConsole.error("Search for used connector classes was forcefully terminated");
+ getLogger()
+ .severe("Search for used connector classes was forcefully terminated");
break;
}
}
@@ -136,4 +137,7 @@ public class OptimizedWidgetsetPanel extends FlowPanel {
return s;
}
+ public static Logger getLogger() {
+ return Logger.getLogger(OptimizedWidgetsetPanel.class.getName());
+ }
}