Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
Advanced Wiki Search
Table of
Contents...
Hide

Project Zero Developer’s Guide?

Concepts and components
Basic concepts overview
Event processing
Writing Java handlers
Writing Groovy handlers
Firing events
Global Context
Global Context reference
Application directory layout?
Virtualized directories
Assemble
PHP
Features and configuration
Configuration
Debugging?
Dependencies?
Packaging?
Application classpath
Logging and tracing
RESTful resources?
RESTful documentation?
File serving
Response rendering
Validators and validation
HTTP error handling
Calling a remote resource
Using the Connection API
Sending an email using EmailConnection
Configuring destinations
Configuring protocols
Configuring connection handlers
Creating a connection handler
Creating a custom protocol transport
Simple logging connection handlers
Protocol reference
Client programming with Dojo
Runtime options
Deployment modifications
HTTP configuration
SSL configuration
Proxy configuration
Extending the CLI
Security considerations
Authentication
OpenID authentication
Extending security
Security tokens
CSRF prevention support
Extending token support
Leveraging TAI
User service
File based user service
LDAP user service
Extending user service
Security Utilities
Leveraging XOREncoder
Extensions
Atom support
RSS support
JSON support
XMLEncoder
REST to SOAP extension
URIUtils
Developer Web tools?
Database setup tools
Configuring data access
Common query patterns
Advanced query patterns
Update patterns
Local database transactions
Extending data access
Configuration vendor differences
PHP data access
Resource model
Configuring ZRM
Resource model declaration
Programmatic model API
HTTP REST API
A ZRM mini tutorial
Active content filtering support
Default filters
Custom filters
Runtime management
Management commands
Zero socket opener
Other extension modules
Amazon E-commerce service
Flickr service
WeatherZero forecast service
Wikipedia service
Reference
Zero command line interface
JavaDoc - Public API
JavaDoc - Public SPI
JavaDoc - All Classes

 

Simple logging connection handlers

Two logging connection handlers are included with the connection infrastructure. These are designed for simple scenarios and as an aid to problem determination when using the Connection API to work with a remote service.

SimpleJavaLoggerHandler
Writes values read from the GlobalContext using the Java logging API.
SimpleDestinationLoggerHandler
Sends values read from the GlobalContext to a destination using the POST operation of the Connection API.

Configuration and usage

The deployment and configuration requirements of the simple loggers are similar to each other, the differences being related to the configuration of where the logging information should be sent to.

SimpleJavaLoggerHandler

When configured, SimpleJavaLoggerHandler writes a log entry corresponding to each onRequest() and onResponse() invocation using the Java logging API. The contents of the log entry is controlled by the configuration supplied to SimpleJavaLoggerHandler and may include the values of one or more GlobalContext keys. The log message text represents these as a human-readable set of name-value pairs, using toString().

The following example demonstrates the configuration for the SimpleJavaLoggerHandler:

/config/connection/destinations += [{
        "name" : "http:///www.projectzero.org/*",
        "handlers" : [{
                "class" : "zero.core.connection.handlers.logger.SimpleJavaLoggerHandler",
                "config" : {
                        "logger" : "mylogger",
                        "source" : "mySource",
                        "level" : "INFO",
                        "request" : {
                                "method" : "myMethodName"
                                "keys" : ["/connection/request/target","/connection/request/operation"]
                        }
                        "response" : {
                                "method" : "myMethodName"
                                "keys" : ["/connection/response/body"]
                        }
                }
        }]
}]

logger (optional)
The name of the java.util.logging.Logger to be written to. The logger name will be used as an argument to Logger.getLogger(logger). The default value is zero.core.connection.handlers.logger.SimpleJavaLoggerHandler.

source (optional)
Name to be used as the source class for logging. The default value is zero.core.connection.handlers.logger.SimpleJavaLoggerHandler.

level (optional)
The logging Level to be used for logging. The default value is INFO.

request (optional)
Specifies configuration for request message log:

method (optional)
Method name to be used when logging request. The default value is request.

keys (optional)
List of GlobalContext keys to be logged for request. The default value a list containing the single value, /connection/request/body.

response (optional)
Specifies configuration for response message log:

method (optional)
Method name to be used when logging response. The default value is response.

keys (optional)
List of GlobalContext keys to be logged for response. The default value a list containing the single value, /connection/response/body.

For more information about connection destination processing and configuration, see Configuring destinations. For a description of connection handler configuration, see Configuring connection handlers.

SimpleDestinationLoggerHandler

When configured, SimpleDestinationLoggerHandler POST a message corresponding to each onRequest() and onResponse() invocation using the Connection API. The log destination and contents of the message are controlled by the configuration supplied to SimpleDestinationLoggerHandler and may include the values of one or more GlobalContext keys.

The message body contains a Map of GlobalContext key to value Object. The representation of this Map received by the log destination will depend on the configuration of connection handlers for the log destination and the protocol used. For example, the default representation of the message sent using the http protocol will be a human-readable set of name-value pairs, using toString().

The SimpleDestinationLoggerHandler does not guarantee that every request or response passing through the destination will be successfully logged. If the SimpleDestinationLoggerHandler is unable to complete the POST to the log destination the processing of the request or response will continue without a corresponding entry being placed in the log.

The following example demonstrates the configuration for the SimpleDestinationLoggerHandler:

/config/connection/destinations += [{
        "name" : "http:///www.projectzero.org/*",
        "handlers" : [{
                "class" : "zero.core.connection.handlers.logger.SimpleDestinationLoggerHandler",
                "config" : {
                        "destination" : "http://localhost:8080/loggerservice"
                        "request" : {
                                "keys" : ["/connection/request/target","/connection/request/operation"]
                        }
                        "response" : {
                                "keys" : ["/connection/response/body"]
                        }
                }
        }]
}]

destination (required)
Specifies the target resource name for the log destination. This may be any connection destination using a protocol that supports the POST operation and is able to accept Map request bodies. Examples include HTTP and SMTP.

request (optional)
Specifies configuration for request message log:

keys (optional)
List of GlobalContext keys to be logged for request. The default value a list containing the single value, /connection/request/body.

response (optional)
Specifies configuration for response message log:

keys (optional)
List of GlobalContext keys to be logged for response. The default value a list containing the single value, /connection/response/body.

For more information about connection destination processing and configuration, see Configuring destinations. For a description of connection handler configuration, see Configuring connection handlers.

r7 - 02 Feb 2008 - 09:03:10 - rushall
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site