|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.Layout
org.apache.log4j.PatternLayout
org.apache.log4j.ext.SnmpDelimitedConversionPatternLayout
This layout allows you to embed trap specific OID's in the conversion pattern defined in the
configuration script, assigning each embedded OID to a specific element of the LoggingEvent. Each element
obtained this way will be appended as a separate VarBind to the trap's PDU. Thus, you can have the
Level (DEBUG, WARN, ERROR, etc.) as one VarBind, the logging message as another, the class name, or date,
or whatever, as yet more.. Each VarBind thus defined will typically be displayed by the SNMP managment
application that receives the trap as a discrete element -- this makes the trap much more readable and
can dramatically increase the usefulness of the appender.
When using this Layout class, the appender assumes that the conversion pattern string in the
properties file will be in the following format:
(LoggingEvent element)(Value of the varDelim
parameter of this class)(trap OID)(Value of the
valuePairDelim
parameter of this class)....(pattern repeats n+ times).
... where value pairs of conversion characters and applicationTrapOIDs are delimited
by the valuePairDelim
variable (defined in log4j config, default is /). Within
these value pairs the values are delimited by the varDelim
variable (defined in
log4j config, default is ;).
Each conversion character is then formatted into the specific logging
information data it represents. It is then bound to the SNMP PDU as a VarBind,
with the applicationTrapOID as the name, and the logging data string as the value...
Thus, in the following example:
"p;1.3.6.1.4.1.24.100.1/%m;1.3.6.1.4.1.24.100.2/%C;1.3.6.1.4.1.24.100.3"
... the "p" element of the LoggingEvent (the Level) is mapped with the OID "1.3.6.1.4.1.24.100.1" to a
discrete VarBind, the "m" element of the LoggingEvent (the message) is mapped with the OID
"1.3.6.1.4.1.24.100.2" to another discrete VarBind, and so on.
Version 1.0.1
2001-09-29
changes ---
2003.03.23: mwm : moved the #formatMultipleVarBinds method from the Appender, where it didn't seem
to belong, to this class. Given the details of the task that this method resolves, and the means
that it uses to do so, it seems a better fit as a responsibility of this class.
Field Summary |
Fields inherited from class org.apache.log4j.PatternLayout |
BUF_SIZE, DEFAULT_CONVERSION_PATTERN, MAX_CAPACITY, TTCC_CONVERSION_PATTERN |
Fields inherited from class org.apache.log4j.Layout |
LINE_SEP, LINE_SEP_LEN |
Constructor Summary | |
SnmpDelimitedConversionPatternLayout()
|
Method Summary | |
void |
formatMultipleVarBinds(org.apache.log4j.spi.LoggingEvent event,
SnmpTrapSenderFacade out)
Breaks the conversion pattern string itself up and, using the tokens thus found, builds distinct VarBinds out of the OID's embedded in the conversion pattern string and the escaped elements of the LoggingEvent. |
java.lang.String |
getValuePairDelim()
Gets the value of the delimiter used in the conversion pattern string to delimit value pairs that should be added as separate VarBind variables to the trap. |
java.lang.String |
getVarDelim()
Gets the value of the delimiter used in the conversion pattern string to delimit the key and value in a value pair embedded within the string. |
boolean |
ignoresThrowable()
Override this to insulate us from potential changes to the super class. |
void |
setValuePairDelim(java.lang.String valuePairDelim)
Sets the value of the delimiter used in the conversion pattern string to delimit value pairs that should be added as separate VarBind variables to the trap. |
void |
setVarDelim(java.lang.String varDelim)
Sets the value of the delimiter used in the conversion pattern string to delimit the key and value in a value pair embedded within the string. |
Methods inherited from class org.apache.log4j.PatternLayout |
activateOptions, createPatternParser, format, getConversionPattern, setConversionPattern |
Methods inherited from class org.apache.log4j.Layout |
getContentType, getFooter, getHeader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SnmpDelimitedConversionPatternLayout()
Method Detail |
public java.lang.String getValuePairDelim()
public void setValuePairDelim(java.lang.String valuePairDelim)
valuePairDelim
- public java.lang.String getVarDelim()
public void setVarDelim(java.lang.String varDelim)
varDelim
- public boolean ignoresThrowable()
public void formatMultipleVarBinds(org.apache.log4j.spi.LoggingEvent event, SnmpTrapSenderFacade out)
event
- out
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |