org.apache.oozie.service
Class XLogService

java.lang.Object
  extended by org.apache.oozie.service.XLogService
All Implemented Interfaces:
Service, Instrumentable

public class XLogService
extends java.lang.Object
implements Service, Instrumentable

Built-in service that initializes and manages Logging via Log4j.

Oozie Lo4gj default configuration file is oozie-log4j.properties.

The file name can be changed by setting the Java System property oozie.log4j.file.

The Log4j configuration files must be a properties file.

The Log4j configuration file is first looked in the Oozie configuration directory see ConfigurationService. If the file is not found there, it is looked in the classpath.

If the Log4j configuration file is loaded from Oozie configuration directory, automatic reloading is enabled.

If the Log4j configuration file is loaded from the classpath, automatic reloading is disabled.

the automatic reloading interval is defined by the Java System property oozie.log4j.reload. The default value is 10 seconds.


Field Summary
static java.lang.String DEFAULT_LOG4J_PROPERTIES
          Default value for the log4j configuration file if LOG4J_FILE_ENV is not set.
static java.lang.String DEFAULT_RELOAD_INTERVAL
          Default value for the reload interval if LOG4J_RELOAD_ENV is not set.
static java.lang.String GROUP
          Group log info constant.
static java.lang.String LOG4J_FILE_ENV
          System property that indicates the log4j configuration file to load.
static java.lang.String LOG4J_RELOAD_ENV
          System property that indicates the reload interval of the configuration file.
static java.lang.String USER
          Group log info constant.
 
Fields inherited from interface org.apache.oozie.service.Service
CONF_PREFIX
 
Constructor Summary
XLogService()
           
 
Method Summary
 void destroy()
          Destroy the log service.
 java.lang.Class<? extends Service> getInterface()
          Return the public interface for log service.
 void init(Services services)
          Initialize the log service.
 void instrument(Instrumentation instr)
          Instruments the log service.
 void streamLog(XLogStreamer.Filter filter, java.util.Date startTime, java.util.Date endTime, java.io.Writer writer)
          Stream the log of a job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_FILE_ENV

public static final java.lang.String LOG4J_FILE_ENV
System property that indicates the log4j configuration file to load.

See Also:
Constant Field Values

LOG4J_RELOAD_ENV

public static final java.lang.String LOG4J_RELOAD_ENV
System property that indicates the reload interval of the configuration file.

See Also:
Constant Field Values

DEFAULT_LOG4J_PROPERTIES

public static final java.lang.String DEFAULT_LOG4J_PROPERTIES
Default value for the log4j configuration file if LOG4J_FILE_ENV is not set.

See Also:
Constant Field Values

DEFAULT_RELOAD_INTERVAL

public static final java.lang.String DEFAULT_RELOAD_INTERVAL
Default value for the reload interval if LOG4J_RELOAD_ENV is not set.

See Also:
Constant Field Values

USER

public static final java.lang.String USER
Group log info constant.

See Also:
Constant Field Values

GROUP

public static final java.lang.String GROUP
Group log info constant.

See Also:
Constant Field Values
Constructor Detail

XLogService

public XLogService()
Method Detail

init

public void init(Services services)
          throws ServiceException
Initialize the log service.

Specified by:
init in interface Service
Parameters:
services - services instance.
Throws:
ServiceException - thrown if the log service could not be initialized.

destroy

public void destroy()
Destroy the log service.

Specified by:
destroy in interface Service

getInterface

public java.lang.Class<? extends Service> getInterface()
Return the public interface for log service.

Specified by:
getInterface in interface Service
Returns:
XLogService.

instrument

public void instrument(Instrumentation instr)
Instruments the log service.

It sets instrumentation variables indicating the config file, reload interval and if loaded from the classpath.

Specified by:
instrument in interface Instrumentable
Parameters:
instr - instrumentation to use.

streamLog

public void streamLog(XLogStreamer.Filter filter,
                      java.util.Date startTime,
                      java.util.Date endTime,
                      java.io.Writer writer)
               throws java.io.IOException
Stream the log of a job.

Parameters:
filter - log streamer filter.
startTime - start time for log events to filter.
endTime - end time for log events to filter.
writer - writer to stream the log to.
Throws:
java.io.IOException - thrown if the log cannot be streamed.


Copyright © 2010 Yahoo. All Rights Reserved.