Here i will explain, How you can configure your log settings in your red5 application in order to acheive that.Let say you have an application with name Test.Open the log4j.properties file under your application WEB-INF folder, Initially the contents will be -
# logging config, this should be auto reloaded by spring.
Now you can change it to -
#-----------------------------------------------------------------
#log4j.rootCategory=, A1
#log4j.appender.A1=org.apache.log4j.net.SocketAppender
#log4j.appender.A1.RemoteHost=XX.XX.XX.XX
#log4j.appender.A1.Port=8888
#log4j.appender.A1.Threshold=DEBUG
#log4j.appender.A1.locationInfo=true
#----------------------------------------------------------------------
The above lines describes that upon running the application, it will connect to this remote address on port 8888.
Now you can also put the server name in your log messages, so that at receiving end, you can differentiate the log messages coming from different red5 servers. To acheive that, we will add some line in our application source.
//------------------------------------------------------------------
public boolean appStart(IScope app){
String servername = null;
try{
servername = java.net.InetAddress.getLocalHost().getHostName();
}
catch(UnknownHostException un){
log.error("Unknown host exception found while getting host name of sever " + un);
}
catch(Exception e){
log.error("Exception while getting host name of sever " + e);
}
if(servername != null){
MDC.put("red5server",servername);
}
log.info("AppStart called for : " + app.getName());
if (!super.appStart(app)){
log.error("Unable to start the application");
return false;
}
return true;
}
//-------------------------------------------------------------
You can see from the above piece of code, that we have created a variable called "red5server" and we are putting the server name in that.This variable will be accessed by log4j server later.
Now, the sending part is complete, We have to implement the receiving end i.e. The log4j server, which will receive all these log messages.
In order to run log4j server, you need to create a properties file. I am showing here, a sample file called "socketserver.properties". The contents of the file will be-
#--------------------------------------------------------------------
log4j.rootLogger=, A1
#log4j.appender.A1=org.apache.log4j.ConsoleAppender
#log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
#log4j.appender.A1.layout.ConversionPattern= %X{red5server} %5p [%t] (%F:%L) - %m%n
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File= remote-log.log
log4j.appender.A1.MaxFileSize=1024KB
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern= %1.25X{red5server}- %p %t %c - %m%n
#------------------------------------------------------------------
Now you can see from above lines, I have referred to the same variable, i have created in source file.
"log4j.appender.A1.layout.ConversionPattern= %X{red5server} %5p [%t] (%F:%L) - %m%n"
This piece of code will add the red5 server name in the begining of every log message.
You can now start the log4j server in order to receive the logs from applications in this way-
java -cp log4j-1.2.14.jar org.apache.log4j.net.SimpleSocketServer 8888 socketserver.properties
Now your log4j server is up and running, Every application, which is referring to this log server will throw their log messages to this server, which you can later on view.
Happy logging!!
To create new Red5 application, follow my post here

Screen 1- Conference Mode
Screen 2- Audience Mode
Screen 3- Multi color Interface








