Oracle Server E10293-02 Manuale Utente
Event Processing in Log4j
Accounting Event API
C-5
Event Filtering
By uncommenting or commenting categories in the Log4j configuration file
(log4j.xml), events can be enabled or disabled as illustrated in
(log4j.xml), events can be enabled or disabled as illustrated in
Log4j configuration determines which events generated from the servlets are logged to
the event.log file.
the event.log file.
illustrates a Log4j configuration for displaying 200 (OK) responses to
INVITE and BYE requests from the EventTestServlet. These responses are logged
to the event.log file.
to the event.log file.
Example C–3
Log4j Configuration for Displaying BYE Requests and 200 (OK)
Responses to INVITE Requests
<category
name=
"
eventlogger.com.example.EventTestServlet.RESPONSE.INVITE.200
"
additivity=
"
false
"
>
<priority value=
"
ALL
"
/>
<appender-ref ref=
"
EVENTLOGGER
"
/>
<appender-ref ref=
"
EVENTLOGGER_LOCAL
"
/>
</category>
<category name=
"
eventlogger.com.example.EventTestServlet.REQUEST.BYE
"
additivity=
"
false
"
>
<priority value=
"
ALL
"
/>
<appender-ref ref=
"
EVENTLOGGER
"
/>
<appender-ref ref=
"
EVENTLOGGER_LOCAL
"
/>
</category>
Note the notation with class name and type of RESPONSE/REQUEST.
Event Formatting and Destination
The format of the events in the event.log is determined by the layout class in
Log4j
Log4j
. The default layout class used for SipServlet event logging is
oracle.sdp.eventlogger.BasicLayout
, and it logs each event as a single row
with comma-separated attributes. The method toString() is then called on the
attribute keys and values, which are concatenated with an equals sign (= ). The
BasicLayout
attribute keys and values, which are concatenated with an equals sign (= ). The
BasicLayout
class also adds the attributes described in
. If needed, you can
create a new layout class.
The configuration also determines where events will be sent, for example to console,
file, syslog, remote socket, or JMS. In
file, syslog, remote socket, or JMS. In
the events are logged to a file, by
using syslog to the localhost (127.0.0.1).
For more information about Log4j, see
http://logging.apache.org/log4j
.
Example C–4
Logging Events to a File
<appender name=
"
EVENTLOGGER_LOCAL
"
class=
"
org.oracle.logging.appender.RollingFileAppender
"
>
<param name=
"
File
"
value=
"
/var/log/sdp/events.log
"
/>
<param name=
"
Append
"
value=
"
true
"
/>
<param name=
"
MaxFileSize
"
value=
"
100000KB
"
/>
Table C–4
Event Logging Attributes
Attribute Key
Description of Attribute Value
Creation Time
The event creation time in format:
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
TimeZoneOffset
The offset, in minutes from GMT