[Red5] webapps
Walter Tak
walter at waltertak.com
Mon Aug 10 07:07:25 PDT 2009
Yes and no ;
you can make a copy and edit the configuration files (properties, xml, logback) but one thing is hardcoded inside an application: the name of the app for the logging.
So you need to change 1 line of code inside your Application.java/class , recompile and redeploy.
There is a one-time fix for this: Do not compile the name of your application inside your application.
Workaround:
Set the name of the logger in file [red5-web.xml] like:
<bean id="web.handler" class="loadtest.Application"> <property name="applicationId" value="loadtest" /> </bean>The name of the class can be just "Application" or "com.yourcompany.this.that.Application" etc.
Next add a getter and a setter to your file [Application.java]:
private String sNameOfMyApp = "default"; // this private string will be filled by the setter method and read by the getter method.
// setter
public void setApplicationId(String sId) {
sNameOfMyApp = sId;
log = Red5LoggerFactory.getLogger(Application.class, sNameOfMyApp);
log.info("[E] setApplicationId: " + sId + " is starting.");
}
// getter
public String getApplicationId() {
return sNameOfMyApp;
}
The setter will be called before [appStart] and thus initialize the logger with the external parameter.
Example output in my log [./log/loadtest.log]:
2009-08-10 15:59:41,234 [main] DEBUG root - Starting up context loadtest
2009-08-10 15:59:41,484 [Launcher:/loadtest] INFO loadtest.Application - [E] setApplicationId: loadtest is starting.
2009-08-10 15:59:41,484 [Launcher:/loadtest] INFO loadtest.Application - [E] appStart: loadtest is starting.
Snippet from Application.java:
public boolean appStart(IScope iscope_application) {
log.info("[E] appStart: " + sNameOfMyApp + " is starting.");
...
Just tested this and it works. I recommend this to use in the examples about logging. It's very flexible since it removes the hard-coded name of the application to be used for logging.
W.
----- Original Message -----
From: AMP Admin
To: red5 at osflash.org
Sent: Monday, 10 August 2009 15:33
Subject: [Red5] webapps
Sorry if this is a dumb question but can we duplicate a directory/app and rename it in webapps? Like if we have a streaming app and we want to create another one that does the same thing but with a different name.
------------------------------------------------------------------------------
_______________________________________________
Red5 mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090810/9a72ce49/attachment.html>
More information about the Red5
mailing list