Friday, January 14, 2011

Distributed Logging Service - Research

Binary distribution of Facebook Scribe for Window

Is there any binary distribution of scribe for windows?. I would want to run scribe server in a windows machine without using cygwin. If there is no binary distribution . Is it possible to build one?

AsyncAppender vs JMSAppender

I was also thinking that I could use a JMSAppender. Now, I know that this is not truly asynchronous, because each logging request is not actually performed in a separate thread. But since performance is usually degraded due to IO (i.e. writing log to a file), this solution may still be somewhat asynchronous.


How to attach multiple appenders to AsyncAppender so that certain application log data should go to FileLogger and certain should go to JMSAppender..??? Should I need to specify in log4j.properties file if so pls give details how to do the same...??????
http://www.theserverside.net/discussions/thread.tss?thread_id=18735

Below defines how to add multiple file appenders in Log4J properties file and then sending logs to appropriate appender from the application code:

You could define two loggers in the log4j.properties file like this.
# Declare the appenders
log4j.logger.app.file = DEBUG, fileappender
log4j.logger.app.jms = DEBUG, jmsappender

# Now Specify the properties for the appenders, for ex:
#File - Refer to Log4J for additional properties
log4j.appender.fileAppender=org.apache.log4j.RollingFileAppender
log4j.appender.fileAppender.File=Log.xml
log4j.appender.fileAppender.MaxFileSize=100KB

#JMS - Refer to Log4J for additional properties
log4j.appender.jmsappender=org.apache.log4j.net.JMSAppender
log4j.appender.jmsappender.TopicBindingName=LOGGING_TOPIC

And finally from your application, refer to these appenders based on where you want to log your messages to. Ex:

# File logging
Logger fileLogger= Logger.getLogger( "app.file" );
fileLogger.debug("This will be logged to file" );

# JMS logging
Logger jmsLogger= Logger.getLogger( "app.jms" );
jmsLogger.debug("This will be put in queue for specified topic" );

Another Logging Framework - Logback Project

Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off.

Logback's basic architecture is sufficiently generic so as to apply under different circumstances. At present time, logback is divided into three modules, logback-core, logback-classic and logback-access.

The logback-core module lays the groundwork for the other two modules. The logback-classic module can be assimilated to a significantly improved version of log4j. Moreover, logback-classic natively implements the SLF4J API so that you can readily switch back and forth between logback and other logging frameworks such as log4j or java.util.logging (JUL).

The logback-access module integrates with Servlet containers, such as Tomcat and Jetty, to provide HTTP-access log functionality. Note that you could easily build your own module on top of logback-core.


Perf4J Framework
http://perf4j.codehaus.org/devguide.html

StopWatch could be used to log the timings very easily
StopWatch stopWatch = new LoggingStopWatch();

try {
// the code block being timed - this is just a dummy example
long sleepTime = (long)(Math.random() * 1000L);
Thread.sleep(sleepTime);
if (sleepTime > 500L) {
throw new Exception("Throwing exception");
}

stopWatch.stop("codeBlock2.success", "Sleep time was <>
} catch (Exception e) {
stopWatch.stop("codeBlock2.failure", "Exception is: " + e);
}

Perf4J used for logging performancee statistics (http://perf4j.codehaus.org/devguide.html)

Following are some of the key features:

# Adding Timing Statements
# Parsing Log Files to Generate Performance Statistics
# Using the log4j Appenders to Generate Real-Time Performance Information

* Writing Graphs with the GraphingStatisticsAppender
* Exposing Performance Statistics as JMX Attributes

# Exposing Performance Graphs in a Web Application
# Unobtrusive Logging with @Profiled and AOP

* Adding the Profiled Annotation to Method Declarations
* Using AspectJ Load-Time Weaving to Integrate Timing Aspects at Run Time
* Using the AspectJ Compiler to Integrate Timing Aspects at Compile Time
* Using Spring AOP to Integrate Timing Aspects
* Using EJB Interceptors to Integrate Timing Aspects

No comments:

Post a Comment