Browse Source

Helper method for enabling all Atmosphere logging

Change-Id: Ibd26d84bd67a244e3a1837491652a84b85f40f65
tags/7.6.0.alpha4
Artur Signell 8 years ago
parent
commit
672e035c36

+ 30
- 0
server/src/com/vaadin/server/communication/AtmospherePushConnection.java View File

@@ -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);
}

}

+ 1
- 1
server/tests/src/com/vaadin/tests/server/ClassesSerializableTest.java View File

@@ -73,7 +73,7 @@ public class ClassesSerializableTest extends TestCase {
"com\\.vaadin\\.server\\.AbstractClientConnector\\$1\\$1", //
"com\\.vaadin\\.server\\.JsonCodec\\$1", //
"com\\.vaadin\\.server\\.communication\\.PushConnection", //
"com\\.vaadin\\.server\\.communication\\.AtmospherePushConnection", //
"com\\.vaadin\\.server\\.communication\\.AtmospherePushConnection.*", //
"com\\.vaadin\\.util\\.ConnectorHelper", //
"com\\.vaadin\\.server\\.VaadinSession\\$FutureAccess", //
"com\\.vaadin\\.external\\..*", //

Loading…
Cancel
Save