Saturday, March 19, 2011

Remote logging with Log4j

I'm writing about Log4j's Socket Appender. I can't just use and stay quiet. It's just really useful. So here is the case. You have a web application running in multiple instances behind a load balancer. Each server is going to have a log file and yes it's hard too track the log files down across multiple instances. If an instance is terminated you might even lose the log file. So we are gonna need a central log server that aggregates the log files to the central log server and this is done by log4j's Socket Appender.

I'll demonstrate it on my local computer but it would simply work for the case. I assume you have already installed and configured log4j for you application.

First we need to setup the log server. For this we use org.apache.log4j.net.SimpleSocketServer that can service multiple SocketAppender clients. SimpleSocketListener waits for logging events from SocketAppender clients. After reception the events are logged according to the server policy. It takes two parameters: port and configFile; where port is the port to listen on and configFile is configuration script in properties or XML format.

Tuesday, March 1, 2011

Jorge Ortiz on Panel: Scaling with Scala

Viktor Klang on Building loosely coupled and scalable systems using EDA

Paul Chiusano on Actors: can we do better?

Christopher League on Continuations and Other Functional Patterns

Josh Suereth on Implicits without import tax: How to make clean APIs with implicits

Nathan Hamblen on Building an HTTP streaming API with Scala

Harry Heymann on Advanced Lift Techniques

Jonas Bonér on Akka: Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors

Runar Bjarnason on The Guerrilla Guide to Pure Functional Programming

Nermin Serifovic on Scala Performance Considerations

Mark Harrah sbt 0.9: Why, what, how?

Daniel Spiewak on Extreme Cleverness: Functional Data Structures in Scala