[Red5devs] [red5 commit] r3078 - doc/trunk java/server/branches/paulg_mp4/src/org/red5/server java/server/branches/paulg_m...
codesite-noreply at google.com
codesite-noreply at google.com
Sun Sep 21 09:04:23 PDT 2008
Author: mondain
Date: Sun Sep 21 09:02:52 2008
New Revision: 3078
Removed:
java/server/branches/paulg_mp4/src/org/red5/server/jboss/
Modified:
doc/trunk/changelog.txt
java/server/branches/paulg_mp4/src/org/red5/server/Bootstrap.java
java/server/branches/paulg_mp4/src/org/red5/server/Standalone.java
java/server/branches/paulg_mp4/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatLoader.java
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatVHostLoader.java
java/server/trunk/src/org/red5/server/api/Red5.java
java/server/trunk/src/org/red5/server/service/Installer.java
Log:
Updated changelog. Remove jboss from mp4 branch. Small refactor on Installer
Modified: doc/trunk/changelog.txt
==============================================================================
--- doc/trunk/changelog.txt (original)
+++ doc/trunk/changelog.txt Sun Sep 21 09:02:52 2008
@@ -34,6 +34,8 @@
- Added patch for flv metadata handling
- Added patch for RTMPT client
- Added patch for start and stop scripts
+- Fixed logging in web applications
+- Root cause was not being sent on error in Flex message service (Jira
APPSERVER-288)
Other:
- Split demos and flash sources into their own top level directories
Modified: java/server/branches/paulg_mp4/src/org/red5/server/Bootstrap.java
==============================================================================
--- java/server/branches/paulg_mp4/src/org/red5/server/Bootstrap.java
(original)
+++ java/server/branches/paulg_mp4/src/org/red5/server/Bootstrap.java Sun
Sep 21 09:02:52 2008
@@ -33,6 +33,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
+import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
@@ -43,13 +44,18 @@
*/
public class Bootstrap {
- protected static Logger log = LoggerFactory.getLogger(Bootstrap.class);
-
public static void launch(URLClassLoader loader) {
System.setProperty("red5.deployment.type", "bootstrap");
- try {
+ try {
+ //set to use our logger
+
System.setProperty("logback.ContextSelector", "org.red5.logging.LoggingContextSelector");
//install the slf4j bridge (mostly for JUL logging)
SLF4JBridgeHandler.install();
+ //we create the logger here so that it is instanced inside the expected
+ //classloader
+ Logger log = LoggerFactory.getLogger(Bootstrap.class);
+ //see which logger binder has been instanced
+ log.debug("Logger binder: {}",
StaticLoggerBinder.SINGLETON.getClass().getName());
//set default for loading classes with url loader
loader.setDefaultAssertionStatus(false);
//create a logger before anything else happens
@@ -72,7 +78,7 @@
String root = System.getProperty("red5.root");
// if root is null find out current directory and use it as root
- if (root == null) {
+ if (root == null || ".".equals(root)) {
File here = new File("thisisadummyfile");
if (!here.createNewFile()) {
System.err.println("Could not determine current directory");
@@ -80,7 +86,7 @@
} else {
root = here.getCanonicalPath().replaceFirst("thisisadummyfile",
"");
- System.out.println("Current directory: " + root);
+ System.out.printf("Current directory: %s\n", root);
if (!here.delete()) {
here.deleteOnExit();
}
@@ -96,7 +102,7 @@
}
}
- System.out.println("Red5 root: " + root);
+ System.out.printf("Red5 root: %s\n", root);
// look for config dir
String conf = System.getProperty("red5.config_root");
@@ -119,9 +125,7 @@
System.setProperty("red5.conf_file", "red5.xml");
} else {
//fail
- System.err
- .println("Configuration file was not found, server cannot start.
Location: "
- + configFile.getCanonicalPath());
+ System.err.printf("Configuration file was not found, server cannot
start. Location: %s\n", configFile.getCanonicalPath());
System.exit(2);
}
Modified: java/server/branches/paulg_mp4/src/org/red5/server/Standalone.java
==============================================================================
--- java/server/branches/paulg_mp4/src/org/red5/server/Standalone.java
(original)
+++ java/server/branches/paulg_mp4/src/org/red5/server/Standalone.java Sun
Sep 21 09:02:52 2008
@@ -37,16 +37,19 @@
* @author Luke Hubbard, Codegent Ltd (luke at codegent.com)
*/
public class Standalone {
-
- /**
- * Initialize Logging.
- */
- protected static Logger log =
LoggerFactory.getLogger(Standalone.class);
protected static String red5Config = "red5.xml";
//public static DebugPooledByteBufferAllocator allocator;
+ static {
+ //set to use our logger
+
System.setProperty("logback.ContextSelector", "org.red5.logging.LoggingContextSelector");
+
+ //install the slf4j bridge (mostly for JUL logging)
+ SLF4JBridgeHandler.install();
+ }
+
/**
* Re-throws exception
* @param e Exception
@@ -67,9 +70,6 @@
* @throws Throwable Base type of all exceptions
*/
public static void main(String[] args) throws Throwable {
-
- //install the slf4j bridge (mostly for JUL logging)
- SLF4JBridgeHandler.install();
//System.setProperty("DEBUG", "true");
@@ -85,6 +85,10 @@
}
long t1 = System.nanoTime();
+
+ //we create the logger here so that it is instanced inside the expected
+ //classloader
+ Logger log = LoggerFactory.getLogger(Standalone.class);
log.info("{} (http://www.osflash.org/red5)", Red5.getVersion());
log.info("Loading Red5 global context from: {}", red5Config);
Modified:
java/server/branches/paulg_mp4/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
==============================================================================
---
java/server/branches/paulg_mp4/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
(original)
+++
java/server/branches/paulg_mp4/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
Sun Sep 21 09:02:52 2008
@@ -33,6 +33,7 @@
import org.apache.catalina.loader.WebappLoader;
import org.red5.server.api.IServer;
import org.red5.server.tomcat.TomcatLoader;
+import org.red5.server.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,7 +103,7 @@
// create and add root context
File appDirBase = new File(webappFolder);
- String webappContextDir =
formatPath(appDirBase.getAbsolutePath(), "/root");
+ String webappContextDir =
FileUtil.formatPath(appDirBase.getAbsolutePath(), "/root");
Context ctx = embedded.createContext("/", webappContextDir);
ctx.setReloadable(false);
log.debug("Context name: {}", ctx.getName());
Modified:
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatLoader.java
==============================================================================
---
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatLoader.java
(original)
+++
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatLoader.java
Sun Sep 21 09:02:52 2008
@@ -51,6 +51,7 @@
import org.red5.server.api.IApplicationContext;
import org.red5.server.jmx.JMXAgent;
import org.red5.server.jmx.JMXFactory;
+import org.red5.server.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
@@ -270,7 +271,8 @@
String dirName = '/' + dir.getName();
// check to see if the directory is already mapped
if (null == host.findChild(dirName)) {
- String webappContextDir = formatPath(appDirBase.getAbsolutePath(),
dirName);
+ String webappContextDir =
FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName);
+ log.debug("Webapp context directory (full path): {}",
webappContextDir);
Context ctx = null;
if ("/root".equals(dirName) || "/root".equalsIgnoreCase(dirName)) {
log.debug("Adding ROOT context");
@@ -304,7 +306,7 @@
// Dump context list
if (log.isDebugEnabled()) {
for (Container cont : host.findChildren()) {
- log.debug("Context child name: " + cont.getName());
+ log.debug("Context child name: {}", cont.getName());
}
}
@@ -479,7 +481,8 @@
//check if the context already exists for the host
if ((cont = host.findChild(contextName)) == null) {
log.debug("Context did not exist in host");
- String webappContextDir = formatPath(webappFolder, applicationName);
+ String webappContextDir = FileUtil.formatPath(webappFolder,
applicationName);
+ log.debug("Webapp context directory (full path): {}", webappContextDir);
//prepend slash
Context ctx = addContext(contextName, webappContextDir);
if (ctx != null) {
@@ -707,49 +710,4 @@
}
}
- /**
- * Quick-n-dirty directory formatting to support launching in windows,
specifically from ant.
- */
- protected static String formatPath(String absWebappsPath, String
contextDirName) {
- StringBuilder path = new StringBuilder(absWebappsPath.length() +
contextDirName.length());
- path.append(absWebappsPath);
- if (log.isDebugEnabled()) {
- log.debug("Path start: {}", path.toString());
- }
- int idx = -1;
- if (File.separatorChar != '/') {
- while ((idx = path.indexOf(File.separator)) != -1) {
- path.deleteCharAt(idx);
- path.insert(idx, '/');
- }
- }
- if (log.isDebugEnabled()) {
- log.debug("Path step 1: {}", path.toString());
- }
- //remove any './'
- if ((idx = path.indexOf("./")) != -1) {
- path.delete(idx, idx + 2);
- }
- if (log.isDebugEnabled()) {
- log.debug("Path step 2: {}", path.toString());
- }
- //add / to base path if one doesnt exist
- if (path.charAt(path.length() - 1) != '/') {
- path.append('/');
- }
- if (log.isDebugEnabled()) {
- log.debug("Path step 3: {}", path.toString());
- }
- //remove the / from the beginning of the context dir
- if (contextDirName.charAt(0) == '/' && path.charAt(path.length() -
1) == '/') {
- path.append(contextDirName.substring(1));
- } else {
- path.append(contextDirName);
- }
- if (log.isDebugEnabled()) {
- log.debug("Path step 4: {}", path.toString());
- }
- return path.toString();
- }
-
-}
\ No newline at end of file
+}
Modified:
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatVHostLoader.java
==============================================================================
---
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatVHostLoader.java
(original)
+++
java/server/branches/paulg_mp4/src/org/red5/server/tomcat/TomcatVHostLoader.java
Sun Sep 21 09:02:52 2008
@@ -41,6 +41,7 @@
import org.red5.server.LoaderBase;
import org.red5.server.jmx.JMXAgent;
import org.red5.server.jmx.JMXFactory;
+import org.red5.server.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
@@ -122,7 +123,7 @@
String dirName = '/' + dir.getName();
// check to see if the directory is already mapped
if (null == host.findChild(dirName)) {
- String webappContextDir = formatPath(appDirBase.getAbsolutePath(),
dirName);
+ String webappContextDir =
FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName);
Context ctx = null;
if ("/root".equals(dirName) || "/root".equalsIgnoreCase(dirName)) {
log.debug("Adding ROOT context");
@@ -292,7 +293,7 @@
//check if the context already exists for the host
if ((cont = host.findChild(contextName)) == null) {
log.debug("Context did not exist in host");
- String webappContextDir = formatPath(webappRoot, applicationName);
+ String webappContextDir = FileUtil.formatPath(webappRoot,
applicationName);
//prepend slash
Context ctx = addContext(contextName, webappContextDir);
if (ctx != null) {
@@ -567,4 +568,4 @@
JMXAgent.unregisterMBean(oName);
}
-}
\ No newline at end of file
+}
Modified: java/server/trunk/src/org/red5/server/api/Red5.java
==============================================================================
--- java/server/trunk/src/org/red5/server/api/Red5.java (original)
+++ java/server/trunk/src/org/red5/server/api/Red5.java Sun Sep 21 09:02:52
2008
@@ -28,7 +28,7 @@
*
* The code below shows various uses.
* <p>
- * <code>
+ * <code>
* IConnection conn = Red5.getConnectionLocal();<br />
* Red5 r5 = new Red5();<br />
* IScope scope = r5.getScope();<br />
Modified: java/server/trunk/src/org/red5/server/service/Installer.java
==============================================================================
--- java/server/trunk/src/org/red5/server/service/Installer.java (original)
+++ java/server/trunk/src/org/red5/server/service/Installer.java Sun Sep 21
09:02:52 2008
@@ -58,6 +58,8 @@
private String applicationRepositoryUrl;
+ private static final String userAgent = "Mozilla/4.0 (compatible; Red5
Server)";
+
{
log.info("Installer service created");
}
@@ -104,7 +106,7 @@
client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
//get the params for the client
HttpClientParams params = client.getParams();
- params.setParameter(HttpMethodParams.USER_AGENT, "Mozilla/4.0
(compatible; Red5 Server)");
+ params.setParameter(HttpMethodParams.USER_AGENT, userAgent);
//try the wav version first
HttpMethod method = new GetMethod(applicationRepositoryUrl
+ "registry.xml");
//follow any 302's although there shouldnt be any
@@ -199,7 +201,7 @@
client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
//get the params for the client
HttpClientParams params = client.getParams();
- params.setParameter(HttpMethodParams.USER_AGENT, "Mozilla/4.0
(compatible; Red5 Server)");
+ params.setParameter(HttpMethodParams.USER_AGENT, userAgent);
params.setParameter(HttpMethodParams.STRICT_TRANSFER_ENCODING,
Boolean.TRUE);
//try the wav version first
More information about the Red5devs
mailing list