[Red5commits] [red5 commit] r3370 - java/server/trunk/src/org/red5/logging
codesite-noreply at google.com
codesite-noreply at google.com
Fri Jan 9 17:16:24 PST 2009
Author: mondain
Date: Fri Jan 9 16:34:28 2009
New Revision: 3370
Modified:
java/server/trunk/src/org/red5/logging/ContextLoggingListener.java
java/server/trunk/src/org/red5/logging/LoggerContextFilter.java
java/server/trunk/src/org/red5/logging/LoggingContextSelector.java
java/server/trunk/src/org/red5/logging/Red5LoggerFactory.java
Log:
Commented out a lot of the debugging messages i added when debugging the
loggers. Also commented out a future piece of reflection code to determine
the servlet or application contexts dynamically for loggers.
Modified: java/server/trunk/src/org/red5/logging/ContextLoggingListener.java
==============================================================================
--- java/server/trunk/src/org/red5/logging/ContextLoggingListener.java
(original)
+++ java/server/trunk/src/org/red5/logging/ContextLoggingListener.java Fri
Jan 9 16:34:28 2009
@@ -48,13 +48,13 @@
System.out.println("Context destroying...");
String contextName = pathToName(event);
- System.out.printf("About to detach context named %s\n", contextName);
+ //System.out.printf("About to detach context named %s\n", contextName);
ContextSelector selector =
StaticLoggerBinder.getSingleton().getContextSelector();
LoggerContext context = selector.detachLoggerContext(contextName);
if (context != null) {
Logger logger = context.getLogger(LoggerContext.ROOT_NAME);
- logger.info("Shutting down context {}", contextName);
+ logger.debug("Shutting down context {}", contextName);
context.reset();
} else {
System.err.printf("No context named %s was found", contextName);
@@ -77,7 +77,7 @@
LoggerContext context = selector.getLoggerContext();
if (context != null) {
Logger logger = context.getLogger(LoggerContext.ROOT_NAME);
- logger.info("Starting up context {}", contextName);
+ logger.debug("Starting up context {}", contextName);
} else {
System.err.printf("No context named %s was found", contextName);
}
@@ -88,12 +88,13 @@
//}
} catch (Exception e) {
- System.err.println("LoggingContextSelector is not the correct type");
+ //System.err.println("LoggingContextSelector is not the correct type");
e.printStackTrace();
} finally {
//reset the name
- if (selector != null)
+ if (selector != null) {
selector.setContextName(null);
+ }
}
}
Modified: java/server/trunk/src/org/red5/logging/LoggerContextFilter.java
==============================================================================
--- java/server/trunk/src/org/red5/logging/LoggerContextFilter.java
(original)
+++ java/server/trunk/src/org/red5/logging/LoggerContextFilter.java Fri
Jan 9 16:34:28 2009
@@ -43,7 +43,7 @@
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
- System.out.printf("Context name: %s\n", contextName);
+ //System.out.printf("Context name: %s\n", contextName);
LoggingContextSelector selector = (LoggingContextSelector)
StaticLoggerBinder.getSingleton().getContextSelector();
//System.out.printf("Context select type: %s\n",
selector.getClass().getName());
Modified: java/server/trunk/src/org/red5/logging/LoggingContextSelector.java
==============================================================================
--- java/server/trunk/src/org/red5/logging/LoggingContextSelector.java
(original)
+++ java/server/trunk/src/org/red5/logging/LoggingContextSelector.java Fri
Jan 9 16:34:28 2009
@@ -118,7 +118,7 @@
}
public LoggerContext getLoggerContext(String name) {
- System.out.printf("getLoggerContext request for %s\n", name);
+ //System.out.printf("getLoggerContext request for %s\n", name);
//System.out.printf("Context is in map: %s\n",
contextMap.containsKey(name));
return contextMap.get(name);
}
Modified: java/server/trunk/src/org/red5/logging/Red5LoggerFactory.java
==============================================================================
--- java/server/trunk/src/org/red5/logging/Red5LoggerFactory.java (original)
+++ java/server/trunk/src/org/red5/logging/Red5LoggerFactory.java Fri Jan
9 16:34:28 2009
@@ -19,18 +19,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-import java.lang.reflect.Method;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-
import org.slf4j.Logger;
import org.slf4j.impl.StaticLoggerBinder;
-import sun.reflect.Reflection;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.selector.ContextSelector;
-import ch.qos.logback.core.util.StatusPrinter;
/**
* LoggerFactory to simplify requests for Logger instances within
@@ -45,13 +38,16 @@
public static Logger getLogger(Class clazz) {
//determine the red5 app name or servlet context name
String contextName = null;
+
+ /* TODO: For a future day, the context or application will be determined
//get a reference to our caller
Class caller = Reflection.getCallerClass(2);
- System.err.printf("Caller class: %s classloader: %s\n", caller,
caller.getClassLoader());
- //check to see if we've been called by a servlet
- try {
- Class sub = caller.asSubclass(Servlet.class);
- System.err.println("Caller is a Servlet");
+ //System.err.printf("Caller class: %s classloader: %s\n", caller,
caller.getClassLoader());
+
+ try {
+ //check to see if we've been called by a servlet
+ Class sub = caller.asSubclass(Servlet.class);
+ //System.err.println("Caller is a Servlet");
//Method[] methods = caller.getMethods();
//for (Method meth : methods) {
@@ -59,13 +55,13 @@
//}
Method getContext = caller.getMethod("getServletContext", new
Class[0]);
- System.err.printf("got context method - %s\n", getContext);
+ //System.err.printf("got context method - %s\n", getContext);
ServletContext context = (ServletContext)
getContext.invoke(caller, null);
System.err.printf("invoked context\n");
contextName = context.getServletContextName();
- System.err.printf("Servlet context name: %s\n", contextName);
- /*
+ //System.err.printf("Servlet context name: %s\n", contextName);
+
Method getContextName =
context.getClass().getMethod("getServletContextName", new Class[0]);
System.err.printf("got context name\n");
Object ctxName = getContextName.invoke(null, new Object[0]);
@@ -74,10 +70,10 @@
if (ctxName != null && ctxName instanceof String) {
contextName = ctxName.toString();
}
- */
} catch (Exception ex) {
//ex.printStackTrace();
}
+ */
return getLogger(clazz, contextName);
}
@@ -90,7 +86,7 @@
//get the context for the given context name or default if null
LoggerContext ctx = contextName == null ? selector.getLoggerContext() :
selector.getLoggerContext(contextName);
//debug
- StatusPrinter.print(ctx);
+ //StatusPrinter.print(ctx);
return ctx.getLogger(clazz);
}
More information about the Red5commits
mailing list