org.apache.oozie.util
Class XLog.Info

java.lang.Object
  extended by org.apache.oozie.util.XLog.Info
Enclosing class:
XLog

public static class XLog.Info
extends Object

LogInfo stores contextual information to create log prefixes.

LogInfo uses a ThreadLocal to propagate the context.

LogInfo context parameters are configurable singletons.


Constructor Summary
XLog.Info()
          Constructs an empty LogInfo.
XLog.Info(XLog.Info logInfo)
          Construct a new LogInfo object from an existing one.
 
Method Summary
 void clear()
          Clear all parameters set in this logInfo instance.
 void clearParameter(String name)
          Clear a parameter value from the LogInfo context.
 String createPrefix()
          Create the LogInfo prefix using the current parameter values.
static void defineParameter(String name)
          Define a LogInfo context parameter.
static XLog.Info get()
          Return the LogInfo instance in context.
 String getParameter(String name)
          Returns the specified parameter.
static void remove()
          Remove the LogInfo instance in context.
static void reset()
          Remove all defined context parameters.
 void setParameter(String name, String value)
          Set a parameter value in the LogInfo context.
 void setParameters(XLog.Info logInfo)
          Set all the parameter values from the given LogInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XLog.Info

public XLog.Info()
Constructs an empty LogInfo.


XLog.Info

public XLog.Info(XLog.Info logInfo)
Construct a new LogInfo object from an existing one.

Parameters:
logInfo - LogInfo object to copy parameters from.
Method Detail

defineParameter

public static void defineParameter(String name)
Define a LogInfo context parameter.

The parameter name and its contextual value will be used to create all prefixes.

Parameters:
name - name of the context parameter.

reset

public static void reset()
Remove all defined context parameters.


get

public static XLog.Info get()
Return the LogInfo instance in context.

Returns:
The thread local instance of LogInfo

remove

public static void remove()
Remove the LogInfo instance in context.


clear

public void clear()
Clear all parameters set in this logInfo instance.


setParameter

public void setParameter(String name,
                         String value)
Set a parameter value in the LogInfo context.

Parameters:
name - parameter name.
value - parameter value.

getParameter

public String getParameter(String name)
Returns the specified parameter.

Parameters:
name - parameter name.
Returns:
the parameter value.

clearParameter

public void clearParameter(String name)
Clear a parameter value from the LogInfo context.

Parameters:
name - parameter name.

setParameters

public void setParameters(XLog.Info logInfo)
Set all the parameter values from the given LogInfo.

Parameters:
logInfo - LogInfo to copy all parameter values from.

createPrefix

public String createPrefix()
Create the LogInfo prefix using the current parameter values.

Returns:
the LogInfo prefix.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.