From 1cd4ef03c727b0048691fdf5cc5abd982d187dfe Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 25 Oct 2010 13:07:24 +0000 Subject: [PATCH] #5715 server-side logging: some changes to the used log levels svn changeset:15692/svn branch:6.5 --- src/com/vaadin/Application.java | 4 ++-- src/com/vaadin/event/ListenerMethod.java | 2 +- .../server/AbstractApplicationPortlet.java | 4 ++-- .../server/AbstractApplicationServlet.java | 6 +++--- .../server/AbstractCommunicationManager.java | 4 ++-- .../gwt/server/ApplicationRunnerServlet.java | 2 +- .../gwt/server/GAEApplicationServlet.java | 20 +++++++++---------- .../server/PortletApplicationContext2.java | 2 +- .../gwt/widgetsetutils/ClassPathExplorer.java | 7 ++++--- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/com/vaadin/Application.java b/src/com/vaadin/Application.java index 9650146f53..d1962f4551 100644 --- a/src/com/vaadin/Application.java +++ b/src/com/vaadin/Application.java @@ -1191,7 +1191,7 @@ public abstract class Application implements URIHandler, final Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket - logger.warning("SocketException in CommunicationManager." + logger.info("SocketException in CommunicationManager." + " Most likely client (browser) closed socket."); return; } @@ -1219,7 +1219,7 @@ public abstract class Application implements URIHandler, } // also print the error on console - logger.log(Level.SEVERE, "Terminal error:", t); + logger.log(Level.INFO, "Terminal error:", t); } /** diff --git a/src/com/vaadin/event/ListenerMethod.java b/src/com/vaadin/event/ListenerMethod.java index 8c7aa93f81..b8ec0b1828 100644 --- a/src/com/vaadin/event/ListenerMethod.java +++ b/src/com/vaadin/event/ListenerMethod.java @@ -84,7 +84,7 @@ public class ListenerMethod implements EventListener, Serializable { out.writeObject(name); out.writeObject(paramTypes); } catch (NotSerializableException e) { - logger.severe("Fatal error in serialization of the application: Class " + logger.warning("Error in serialization of the application: Class " + object.getClass().getName() + " must implement serialization."); throw e; diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index 8f806ef693..953ab0c5d4 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -455,7 +455,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet } catch (final GeneralSecurityException e) { // TODO Figure out a better way to deal with // GeneralSecurityExceptions - logger.finest("General security exception, the security key was probably incorrect."); + logger.fine("General security exception, the security key was probably incorrect."); } catch (final Throwable e) { handleServiceException(request, response, application, e); } finally { @@ -659,7 +659,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet os.write(buffer, 0, bytes); } } else { - logger.warning("Requested resource [" + resourceID + logger.info("Requested resource [" + resourceID + "] could not be found"); response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(HttpServletResponse.SC_NOT_FOUND)); diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index 5fe94266eb..3e8912770b 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -821,7 +821,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements resultPath = url.getFile(); } catch (final Exception e) { // FIXME: Handle exception - logger.log(Level.WARNING, "Could not find resource path " + logger.log(Level.INFO, "Could not find resource path " + path, e); } } @@ -1203,7 +1203,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements if (resourceUrl == null) { // cannot serve requested file - logger.severe("Requested resource [" + logger.info("Requested resource [" + filename + "] not found from filesystem or through class loader." + " Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder."); @@ -1661,7 +1661,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements try { return getApplicationClass().getSimpleName(); } catch (ClassNotFoundException e) { - logger.log(Level.FINER, "getApplicationCSSClassName failed", e); + logger.log(Level.WARNING, "getApplicationCSSClassName failed", e); return "unknown"; } } diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 7c4a410a81..78cc4e4bae 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -765,7 +765,7 @@ public abstract class AbstractCommunicationManager implements if (window == null) { // This should not happen, no windows exists but // application is still open. - logger.severe("Warning, could not get window for application with request ID " + logger.warning("Could not get window for application with request ID " + request.getRequestID()); return; } @@ -1138,7 +1138,7 @@ public abstract class AbstractCommunicationManager implements r.close(); } catch (final java.io.IOException e) { // FIXME: Handle exception - logger.log(Level.SEVERE, "Resource transfer failed: " + logger.log(Level.INFO, "Resource transfer failed: " + request.getRequestID() + ".", e); } outWriter.print("\"" diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java b/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java index 410fba0ea0..5e660ab82c 100644 --- a/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java +++ b/src/com/vaadin/terminal/gwt/server/ApplicationRunnerServlet.java @@ -177,7 +177,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { } catch (Exception e2) { // TODO: handle exception logger.log( - Level.FINER, + Level.FINE, "Failed to find application class in the default package.", e2); } diff --git a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java index 47067e5b8d..5f8e59e056 100644 --- a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java @@ -94,7 +94,7 @@ import com.vaadin.service.ApplicationContext; */ public class GAEApplicationServlet extends ApplicationServlet { - private static final Logger log = Logger + private static final Logger logger = Logger .getLogger(GAEApplicationServlet.class.getName()); // memcache mutex is MUTEX_BASE + sessio id @@ -209,7 +209,7 @@ public class GAEApplicationServlet extends ApplicationServlet { try { Thread.sleep(RETRY_AFTER_MILLISECONDS); } catch (InterruptedException e) { - log.info("Thread.sleep() interrupted while waiting for lock. Trying again. " + logger.finer("Thread.sleep() interrupted while waiting for lock. Trying again. " + e); } } @@ -252,16 +252,16 @@ public class GAEApplicationServlet extends ApplicationServlet { ds.put(entity); } catch (DeadlineExceededException e) { - log.severe("DeadlineExceeded for " + session.getId()); + logger.warning("DeadlineExceeded for " + session.getId()); sendDeadlineExceededNotification(request, response); } catch (NotSerializableException e) { - log.log(Level.SEVERE, "Not serializable!", e); + logger.log(Level.SEVERE, "Not serializable!", e); // TODO this notification is usually not shown - should we redirect // in some other way - can we? sendNotSerializableNotification(request, response); } catch (Exception e) { - log.log(Level.SEVERE, + logger.log(Level.WARNING, "An exception occurred while servicing request.", e); sendCriticalErrorNotification(request, response); @@ -308,12 +308,12 @@ public class GAEApplicationServlet extends ApplicationServlet { session.setAttribute(WebApplicationContext.class.getName(), applicationContext); } catch (IOException e) { - log.log(Level.WARNING, + logger.log(Level.WARNING, "Could not de-serialize ApplicationContext for " + session.getId() + " A new one will be created. ", e); } catch (ClassNotFoundException e) { - log.log(Level.WARNING, + logger.log(Level.WARNING, "Could not de-serialize ApplicationContext for " + session.getId() + " A new one will be created. ", e); @@ -368,7 +368,7 @@ public class GAEApplicationServlet extends ApplicationServlet { List entities = pq.asList(Builder .withLimit(CLEANUP_LIMIT)); if (entities != null) { - log.info("Vaadin cleanup deleting " + entities.size() + logger.info("Vaadin cleanup deleting " + entities.size() + " expired Vaadin sessions."); List keys = new ArrayList(); for (Entity e : entities) { @@ -387,7 +387,7 @@ public class GAEApplicationServlet extends ApplicationServlet { List entities = pq.asList(Builder .withLimit(CLEANUP_LIMIT)); if (entities != null) { - log.info("Vaadin cleanup deleting " + entities.size() + logger.info("Vaadin cleanup deleting " + entities.size() + " expired appengine sessions."); List keys = new ArrayList(); for (Entity e : entities) { @@ -397,7 +397,7 @@ public class GAEApplicationServlet extends ApplicationServlet { } } } catch (Exception e) { - log.log(Level.WARNING, "Exception while cleaning.", e); + logger.log(Level.WARNING, "Exception while cleaning.", e); } } } diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java index 01f2f0b589..1f5c04ebe5 100644 --- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java +++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java @@ -78,7 +78,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { } catch (final Exception e) { // FIXME: Handle exception logger.log( - Level.FINE, + Level.INFO, "Cannot access base directory, possible security issue " + "with Application Server or Servlet Container", e); diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java index abdf7bd551..f69cc468bf 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java @@ -54,8 +54,8 @@ import com.vaadin.ui.ClientWidget; */ public class ClassPathExplorer { - private static Logger logger = Logger - .getLogger("com.vaadin.terminal.gwt.widgetsetutils"); + private static Logger logger = Logger.getLogger(ClassPathExplorer.class + .getName()); /** * File filter that only accepts directories. @@ -197,7 +197,8 @@ public class ClassPathExplorer { // should never happen as based on an existing URL, // only changing end of file name/path part logger.log(Level.SEVERE, - "This should never happen!", e); + "Error locating the widgetset " + classname, + e); } } } -- 2.39.5