summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-07-29 15:03:44 +0300
committerVaadin Code Review <review@vaadin.com>2015-08-25 11:19:26 +0000
commit672e035c36f4bd2b38c69c2ef9b50428dbc266d7 (patch)
treed8017260184d3225a12c2f71705c28e665aebe1e /server/src
parent136e24ab7464c03b9c85abae3a431ff6f1195732 (diff)
downloadvaadin-framework-672e035c36f4bd2b38c69c2ef9b50428dbc266d7.tar.gz
vaadin-framework-672e035c36f4bd2b38c69c2ef9b50428dbc266d7.zip
Helper method for enabling all Atmosphere logging
Change-Id: Ibd26d84bd67a244e3a1837491652a84b85f40f65
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/server/communication/AtmospherePushConnection.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
index a45d9aa059..e1bc8e212b 100644
--- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
+++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
@@ -26,7 +26,9 @@ import java.io.Writer;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
+import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.atmosphere.cpr.AtmosphereResource;
@@ -352,4 +354,32 @@ public class AtmospherePushConnection implements PushConnection {
private static Logger getLogger() {
return Logger.getLogger(AtmospherePushConnection.class.getName());
}
+
+ /**
+ * Internal method used for reconfiguring loggers to show all Atmosphere log
+ * messages in the console.
+ *
+ * @since
+ */
+ public static void enableAtmosphereDebugLogging() {
+ Level level = Level.FINEST;
+
+ Logger atmosphereLogger = Logger.getLogger("org.atmosphere");
+ if (atmosphereLogger.getLevel() == level) {
+ // Already enabled
+ return;
+ }
+
+ atmosphereLogger.setLevel(level);
+
+ // Without this logging, we will have a ClassCircularityError
+ LogRecord record = new LogRecord(Level.INFO,
+ "Enabling Atmosphere debug logging");
+ atmosphereLogger.log(record);
+
+ ConsoleHandler ch = new ConsoleHandler();
+ ch.setLevel(Level.ALL);
+ atmosphereLogger.addHandler(ch);
+ }
+
}