Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
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

 

Logging and tracing

Zero applications use the java.util.logging package for log and trace functions. Log and trace configurations are specified in the <appHome>/config/logging.properties file. This file is read and applied automatically by Zero if it is present.

Java logging consists of two principle components: Loggers (sources) and Log Handlers (sinks). Verbosity of each of these components may be controlled through log Level settings.

Default log and trace settings

Default settings for Zero applications use a "log" and console for important messages and a "trace" to include detailed messages. Specifically:
  • Logs and console contain messages of level INFO and above. Logs are written to a rotating output file in the <appHome>/logs directory; error-log-0 is the most recent file.
  • Trace contains messages of level INFO and above. Trace is also written to a rotating output file; <appHome>/logs/trace-log-0 is the most recent file. Trace includes Java exception stack trace details.

Loggers

Loggers are instantiated within application and platform code. For example, in Java code:
    Logger logger = Logger.getLogger("fully.qualified.class.name");

Loggers source LogRecords via Logger APIs or Zero's LogHelper API.

Level settings

Two log levels are compared to determine whether a logging API invocation sources a LogRecord:
  1. Logger level -- Level associated with the logger; specified in logging.properties
  2. API-invocation level -- Level specified in the API invocation (e.g. LogHelper.log(logger, Level.WARNING, ...) )

A logging API invocation sources a LogRecord only if the Logger level is equal or greater than the API-invocation level.

For example, the default Logger level for all Loggers is set in logging.properties as follows:

.level=INFO

One could also set Logger levels for specific Loggers by specifying the package or fully-qualified class name. For example:

# Applies to all loggers under package "fully.qualified"
fully.qualified.level=INFO

# Applies to the class "fully.qualified.class.name"
fully.qualified.class.name.level=INFO

Log handlers

Log handlers are specified in the logging.properties file. Each handler has an associated log level that controls which LogRecords are handled; others are ignored.

# This log handler handles only LogRecords at level WARNING and above;
# Others are ignored
zero.core.logging.LogHandler.level=WARNING

Logging from Groovy scripts

See the Groovy handlers page for details.

Access Logging

Zero provides the ability to log all http requests via access logging. By default access logging is disabled. To enable access logging add the following line to the <apphome>/config/zero.config file:

/config/accessLogging=true

When enabled the <apphome>/logs/access-log will be created. Access log entries will have the format:


   <hostname or IP>   [<local time>]  <http method> <Request URI> <status code> <bytecount>

r15 - 14 Dec 2007 - 17:58:51 - madhu
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site