]> source.dussan.org Git - vaadin-framework.git/commitdiff
VConsole logging -> java.util.logging
authorArtur Signell <artur@vaadin.com>
Tue, 7 Apr 2015 15:38:32 +0000 (18:38 +0300)
committerMarkus Koivisto <markus@vaadin.com>
Wed, 15 Apr 2015 08:59:20 +0000 (11:59 +0300)
Change-Id: Id1b04e1335f0906f8de2d514ff11bc744dc14c49

15 files changed:
client/src/com/vaadin/client/ApplicationConfiguration.java
client/src/com/vaadin/client/ApplicationConnection.java
client/src/com/vaadin/client/ConnectorMap.java
client/src/com/vaadin/client/DateTimeService.java
client/src/com/vaadin/client/JavaScriptConnectorHelper.java
client/src/com/vaadin/client/LayoutManager.java
client/src/com/vaadin/client/MeasuredSize.java
client/src/com/vaadin/client/SuperDevMode.java
client/src/com/vaadin/client/Util.java
client/src/com/vaadin/client/VCaption.java
client/src/com/vaadin/client/WidgetSet.java
client/src/com/vaadin/client/communication/AtmospherePushConnection.java
client/src/com/vaadin/client/communication/RpcManager.java
client/src/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
client/src/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java

index 37d689c6d3b14cb971c735fc22eb67f3dc28db63..f4b2c931111f7de432dd4281410990d0e0b4a239 100644 (file)
@@ -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);
                         }
                     });
         }
index f88a3b6f63cf30ca67e7f9a3b9160c4ad478d811..267ec466116b8f5312d87fe1f3b14c8f93427c20 100644 (file)
@@ -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;
@@ -520,7 +521,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;
         }
@@ -542,16 +543,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;
@@ -855,7 +858,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 + '/');
 
@@ -913,9 +917,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
@@ -939,7 +944,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() {
@@ -971,7 +976,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() {
@@ -1029,7 +1035,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));
             }
@@ -1055,8 +1061,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 {
@@ -1195,9 +1202,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;
@@ -1229,7 +1237,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());
     }
 
@@ -1240,7 +1248,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());
     }
 
@@ -1251,7 +1259,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());
     }
 
@@ -1310,7 +1318,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();
@@ -1319,7 +1328,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,
@@ -1388,7 +1397,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);
             }
         }
     }
@@ -1502,7 +1512,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()) {
@@ -1519,7 +1529,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;
@@ -1538,14 +1548,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;
         }
@@ -1557,7 +1568,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");
@@ -1571,7 +1582,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
@@ -1580,7 +1591,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(
@@ -1588,7 +1599,7 @@ public class ApplicationConnection implements HasHandlers {
 
         }
 
-        VConsole.log("Handling resource dependencies");
+        getLogger().info("Handling resource dependencies");
         if (json.containsKey("scriptDependencies")) {
             loadScriptDependencies(json.getJSStringArray("scriptDependencies"));
         }
@@ -1618,7 +1629,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();
@@ -1661,7 +1672,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);
@@ -1695,9 +1706,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;
 
@@ -1708,14 +1720,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");
                 }
@@ -1746,10 +1759,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,
@@ -1852,7 +1868,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
@@ -1936,7 +1952,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++) {
@@ -1944,7 +1960,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);
                     }
                 }
 
@@ -1961,11 +1978,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
@@ -1976,9 +1994,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");
                     }
 
                 }
@@ -2006,13 +2025,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();
@@ -2063,7 +2083,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);
                     }
                 }
 
@@ -2083,7 +2104,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 {
@@ -2109,18 +2131,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);
                     }
                 }
 
@@ -2135,14 +2159,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);
                     }
                 }
 
@@ -2155,13 +2180,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
@@ -2169,14 +2195,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;
                 }
@@ -2254,7 +2280,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);
                     }
                 }
 
@@ -2296,7 +2323,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;
                 }
@@ -2328,16 +2355,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);
@@ -2390,9 +2419,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");
@@ -2426,7 +2456,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");
                     }
@@ -2573,7 +2604,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"));
@@ -2593,7 +2625,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);
                         }
                     }
 
@@ -2615,8 +2650,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);
             }
@@ -2650,7 +2686,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);
             }
@@ -3142,7 +3179,7 @@ public class ApplicationConnection implements HasHandlers {
 
         layoutManager.forceLayout();
 
-        VConsole.log("forceLayout in " + duration.elapsedMillis() + " ms");
+        getLogger().info("forceLayout in " + duration.elapsedMillis() + " ms");
     }
 
     /**
@@ -3418,8 +3455,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));
     }
 
     /**
@@ -3453,8 +3491,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;
     }
@@ -3516,7 +3556,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();
         }
@@ -3544,7 +3586,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();
             }
         }
index 1211eb26849b53a2e1c6d7831737aa890b036009..3200dd6ab4a3f8ffc0e159ab4061a47f371b7bee 100644 (file)
@@ -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());
+    }
 }
index f4cfe7a278c888d65f21c91f63d95b738fb231ea..56116377cf3722c25b9704cd576b196a69a2f5e9 100644 (file)
@@ -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());
+    }
 }
index 1eb326115e8de4db559148f82c9c5a74908eacda..d992acd8b85186ac7bd6682395d4aa287aa09048 100644 (file)
@@ -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());
+    }
 }
index 828f0942b7718620ece234c038bb99908c1cd49c..3f189bcea8f9885593dd16909645a1cee1b7490f 100644 (file)
@@ -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,
index 8520635a4dc18dc876f942f6206c5924a429ec21..eeedff561fa83b38d910faffdcf44c9ee3e627c7 100644 (file)
@@ -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());
+    }
+
 }
index 821af6075a65886b096217e3bc443aae6f0ab4ec..7bd759a49015b456a459f012f4c47651aba48ccf 100644 (file)
@@ -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());
+    }
 }
index 99e6507d813bb4833cd55219403ca8716e55b88e..e8fbd8855bc961288c014adc48913b71ea0e3da1 100644 (file)
@@ -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());
+    }
 }
index 050edae8bed8343a9643a8d785e16b2145d57667..47c9309b3992f97e61dd4c3b237ae008f3757f08 100644 (file)
@@ -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());
+    }
 }
index eff98a146a2a9a104a8436f062ac0c094d39c2bb..797047367f3be2c2c473e129f674cafb0bdfb219 100644 (file)
@@ -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());
+    }
 }
index e544c91d0f7d5d72849a9e035bef6a2416c36676..124ea0fc5692061bea40198d8ed22ce182ec2548 100644 (file)
@@ -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());
+    }
 }
index f5c3ca9ffb0901e98af6caf5bf1f7f9d91ad21db..83dd6b15bd703b12e0f49ff265fa96f596ea77ca 100644 (file)
 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());
+    }
 }
index 0856bb3575175cb608dd9b799bb89bd9d8a0f800..d26a0ee0764425f83f445cc9406816a381899be9 100644 (file)
@@ -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());
+    }
 }
index e2b1f928de04803338276662fa9aa97bb018f325..5134ed3b2797ab09f45a82336fc9f5b8cead03af 100644 (file)
@@ -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());
+    }
 }