Tuesday, July 24, 2007

Red5 log forwarding to centralized log server

In order to view the log generated by Red5 in some other location( on a different log server on network), You can use the log4j feature to forward your logs to a centralized log sever, where all your applications( multiple red5 servers) are throwing their logs.This way you can later view your organize log through some log interface.

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

Friday, July 20, 2007

Desktop sharing with Red5 and Flash

From Last 15 days, I was trying hard to get it done. My previous research on this and some concept from open source and commercial project, I am finally able to do a complete desktop sharing in my conference application.And the best part is that, I am not using any native driver or so to acheive this, A pure java solution with flash just works fine, I got some idea from here. But i tried a little different approach for this. And the best thing is that, Only the user, who wants to share his desktop need java plugin in his browser,all other users in the conference can just see and control his desktop with their flash client, Screen rendering part is little bit slow at this time, but the mouse and keyboard controls are more faster than i expected.The only frustating part having flash as a desktop sharing client is that, there is no way to remove the flash context menu, So i have done a workaround(got it from some forum) and put right click event on context menu itself.

Now i am trying to make it more faster in terms of performence.

Wednesday, July 04, 2007

Open source video conferencing using Red5 and Open Laszlo

Openmeetings, A new multilanguage, and customizable video conference and group collaboration application very similer to Adobe Connect. They have used Open Laszlo and Red5 as a technology to build this application. The project has various features like screen sharing, Document importing. There are various file format(.tga, .xcf, .wpg, .txt, .ico, .ttf, .pcd, .pcds, .ps, .psd, .tiff, .bmp, .svg, .dpx, .exr, .jpg, .jpeg, .gif, .png, .ppt, .odp, .odt, .sxw, .wpd, .doc, .rtf, .txt, .ods, .sxc, .xls, .sxi, .pdf) that you can import and share with others in the conference.The whiteboard items are draggable, You can edit the items, also some of them are resizable as well, Whiteboard can be stored or recorded.

Take a basic installation demo here



Below are some screenshots of the application-

Screen 1- Conference Mode

Screen 2- Audience Mode

Screen 3- Multi color Interface

For more information visit the home page of Openmeetings here

Related Post
New Version Of Dimdim's Open Source Community Edition Releasing Soon

Daily Technology Tips

Catch me at Mashable

PayPal

Sign up for PayPal and start accepting credit card payments instantly.

Blog Explosion


Bloglines

Blogrush


BlogsByCategory.com