Author: mcconnell
Date: Tue Jun 15 08:42:30 2004
New Revision: 21291
Removed:
avalon/trunk/central/site/src/xdocs/products/runtime/installation/
avalon/trunk/central/site/src/xdocs/products/runtime/system/af4/
avalon/trunk/central/site/src/xdocs/products/runtime/system/kernel.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/features.xml
avalon/trunk/central/site/src/xdocs/products/runtime/tools/ant/
avalon/trunk/central/site/src/xdocs/products/runtime/tools/maven/
Modified:
avalon/trunk/central/site/src/xdocs/products/navigation.xml
avalon/trunk/central/site/src/xdocs/products/runtime/embedded/cli.xml
avalon/trunk/central/site/src/xdocs/products/runtime/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/navigation.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/activation.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/composition.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/api/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/log4j/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/navigation.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/whitepaper.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/meta/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/navigation.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/bootstrap.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/index.xml
avalon/trunk/central/site/src/xdocs/products/runtime/system/util/index.xml
Log:
temporarily supress studio pending availability of docs, reshuffling some content out of runtime and into central, plus minor updates
Modified: avalon/trunk/central/site/src/xdocs/products/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/navigation.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/navigation.xml Tue Jun 15 08:42:30 2004
@@ -24,7 +24,7 @@
<body>
<menu>
<item name="Merlin Runtime" href="runtime/index.html"/>
- <item name="Merlin Studio" href="studio/index.html"/>
+ <!-- <item name="Merlin Studio" href="studio/index.html"/> -->
<item name="Merlin Discovery" href="discovery/index.html"/>
</menu>
</body>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/embedded/cli.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/embedded/cli.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/embedded/cli.xml Tue Jun 15 08:42:30 2004
@@ -27,7 +27,7 @@
<body>
- <section name="Merlin CLI (Command Line Interface)">
+ <section name="Merlin CLI">
<subsection name="Overview">
<p>
Merlin CLI is the command line interface to the Merlin system. It provides support for the declaration of the root block directive, a working home directory, a kernel directive, and other parameters qualifying debug output and language policy.
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/index.xml Tue Jun 15 08:42:30 2004
@@ -15,6 +15,109 @@
<p>
<img src="/images/cover.gif"/>
</p>
+ </section>
+
+ <section name="Purpose">
+ <subsection name="Simplification">
+ <p>
+Merlin aims to simplify the process of managing component-based systems. It achieves this objective through delivery of functionality supporting automated component assembly and deployment.
+ </p>
+ </subsection>
+ <subsection name="Isolation">
+ <p>
+Merlin aims to provide a framework for isolating an application implementation from the service that the application provides. Applications are implemented through component composition. In turn, applications can be exposed as simple components and used by other components in building other applications.
+ </p>
+ </subsection>
+ <subsection name="Distribution">
+ <p>
+A goal of the Merlin project is to provide distribution of services established by system to other Merlin systems across a distributed network environment.
+ </p>
+ </subsection>
+ </section>
+
+ <section name="Features and Benefits">
+ <subsection name="Composite Component Management">
+ <p>
+Merlin provides support for the packaging and deployment of composite components with a structure called a Block. A block represents the association of resources to a containment hierarchy within which components are managed. In addition, a block enables the separation of a component assembly (the composite implementation) from the set of services published by the block.
+ </p>
+ </subsection>
+ <subsection name="Cascading Containers">
+ <p>
+The Merlin system provides support for <strong>cascading containers</strong>. This model enables component assemblers to (among other things) associate jar files under a protected scope where each container is associated with its own classloader.
+ </p>
+ </subsection>
+ <subsection name="Automated Assembly">
+ <p>
+Merlin will handle resolution of service dependencies for components by looking for explicitly declared components commencing within the local container, and working progressively up the container hierarchy. If
+no explicit solutions are resolved, Merlin will attempt to build a packaged or implicit solution based on component types declared in the classloader hierachy.
+ </p>
+ </subsection>
+ <subsection name="Deployment Engine">
+ <p>
+Underlying the Merlin system is a runtime deployment engine that provides support for the orderly establishment of simple and composite components. The deployment engine takes care of component instantiation, lifecycle processing, and component decommissioning.
+ </p>
+ </subsection>
+ <subsection name="Lifestyle Management">
+ <p>
+Merlin provides support for different component instantiation policies. These policies are referred to as lifestyles. Examples of lifestyle include 'singleton', 'per-thread', 'pooled' and 'transient'.
+ </p>
+ </subsection>
+ <subsection name="Lifecycle Management">
+ <p>
+Merlin provides support for constructor based injection of lifecycle artifacts, or optional phased delivery under which a component is processed through a series of lifecycle stages. Lifecycle processing involves the execution of a series of stages such as associating a logging channel, applying a configuration or component parameters, setting the runtime context, supplying dependent services, initialization, startup, shutdown and disposal. Within the Merlin system, lifecycle stages can be extended or modified through association of other components that provide lifecycle support. Merlin distinguishes these services as deployment dependencies as distinct from classic runtime dependencies.
+ </p>
+ </subsection>
+ <subsection name="Seperating Concerns">
+<p>
+Every developer that has written a complex component based application has had to deal with container-side programming. Given normal commercial pressures, it too easy to write code into your application that has assumptions built into it concerning the requirements of the target components.
+</p>
+
+<p>
+Consider the following code fragment:
+</p>
+
+<source>
+
+ // and example of a bad practice of introducing
+ // component deployment strategy and dependencies
+ // into your application logic
+
+ DefaultMonitor monitor = new DefaultMonitor();
+
+ DefaultContext context = new DefaultContext();
+ context.put( "classloader", m_classloader );
+ context.makeReadOnly();
+
+ monitor.enableLogging( m_logger );
+ monitor.contextualize( context );
+ monitor.initialize();
+
+</source>
+
+<p>
+The above container-side code is making a lot of assumptions about the component it is deploying. Firstly, it knows that the component is log enabled, contextualizable, and initializable. This is problematic because it means that the container-side code is dependent on the component implementation. If the component were to be changed so that it supported the configurable semantics, there container-side code needs to be updated as well. This is dangerous because it is easy for container-side to get out-of-sync with the component implementation - for example, the container side code to some extent is dependent on a component properly checking if it has been configured or not. A deeper and more important issue concerns component assembly - if a component is refactored to use other components, then the container-side code become much more complex and much more closely tied to the set of
components that make up the assembly.
+</p>
+
+<p>
+The solution to the above is a framework that automates the process of component deployment. The end result is that container side code becomes independent of the component deployment strategy and component dependencies.
+</p>
+
+<p>Consider the following code fragment in which we create a service description, locate component model that provides the service, commission the model and resolve the service instance.</p>
+
+<source>
+ ReferenceDescriptor reference =
+ new ReferenceDescriptor( Widget.class.getName() );
+ ComponentModel model = (ComponentModel) m_model.getModel( reference );
+ model.commission();
+
+ Widget widget = (Widget) model.resolve();
+</source>
+
+<p>
+The above code demonstrates the elimination of knowledge about the component deployment strategy. All aspect concerning the component logging, configuration, parameterization, contexulization, dependency composition, initialization, startup, shutdown, and disposal are managed by the container.
+</p>
+
+ </subsection>
</section>
</body>
</document>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/navigation.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/navigation.xml Tue Jun 15 08:42:30 2004
@@ -23,13 +23,10 @@
<body>
<menu>
- <item name="About" href="about/index.html"/>
- <item name="Installation" href="installation/index.html"/>
<item name="Embedding" href="embedded/index.html"/>
<item name="Specification"
- href="reference/containment/index.html"/>
- <item name="Systems" href="system/meta/index.html"/>
- <item name="Tools" href="tools/index.html"/>
+ href="reference/index.html"/>
+ <item name="Systems" href="system/index.html"/>
</menu>
</body>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/activation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/activation.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/activation.xml Tue Jun 15 08:42:30 2004
@@ -21,12 +21,12 @@
<properties>
<author email="[email protected]">Stephen McConnell</author>
- <title>Avalon Activation Subsystem</title>
+ <title>Merlin Runtime</title>
</properties>
<body>
- <section name="Avalon Activation Subsystem">
+ <section name="Avalon Activation">
<p>
The activation platform is the runtime that is controlled by
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/composition.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/composition.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/composition.xml Tue Jun 15 08:42:30 2004
@@ -21,12 +21,12 @@
<properties>
<author email="[email protected]">Stephen McConnell</author>
- <title>Avalon Composition Subsystem</title>
+ <title>Merlin Runtime</title>
</properties>
<body>
- <section name="Avalon Composition Subsystem">
+ <section name="Avalon Composition">
<p>
The composition model is the essential fabric that ties together the
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/index.xml Tue Jun 15 08:42:30 2004
@@ -2,11 +2,11 @@
<document>
<properties>
<author email="[email protected]">Avalon Documentation Team</author>
- <title>Runtime Products</title>
+ <title>Merlin Runtime</title>
</properties>
<body>
- <section name="Merlin Runtime System">
+ <section name="Subsystem">
<p>
</p>
</section>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/api/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/api/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/api/index.xml Tue Jun 15 08:42:30 2004
@@ -26,8 +26,7 @@
<body>
- <section name="Avalon Logging">
- <subsection name="Logging System API">
+ <section name="Avalon Logging API">
<p>
The logging API is divided into two sections - one dealing with
meta data directives, and the second dealing with the logging
@@ -54,46 +53,42 @@
<a href="/api/org/apache/avalon/logging/provider/LoggingCriteria.html">
LoggingCriteria</a> interface.
</p>
- </subsection>
+
<subsection name="Standard Properties">
<p>
The following table details the set of standard properties
supported by Logging System.
</p>
<table>
- <tr><th>Property</th><th>Default Value</th><th>Description</th></tr>
+ <tr><th>Property</th><th>Description</th></tr>
<tr>
<td>avalon.logging.configuration</td>
- <td></td>
<td>URL referencing an external logging system configuration.</td>
</tr>
<tr>
<td>avalon.logging.bootstrap</td>
- <td></td>
<td>A logging channel to be used during the bootstrapping phase. Classic
logging priority values of DEBUG, INFO, WARN, ERROR may be assigned and
will be resolved to a console logger with an equivalent priority.</td>
</tr>
<tr>
<td>avalon.logging.basedir</td>
- <td></td>
<td>The base directory to use when constructing file based log targets.
Defaults to the initial working directory declared by the repository
initial context.</td>
</tr>
<tr>
<td>avalon.logging.debug</td>
- <td>false</td>
- <td>Debug flag used to override all logging channels to debug priority.</td>
+ <td>Debug flag used to override all logging channels to debug priority.
+ The default falue is 'false'.</td>
</tr>
<tr>
<td>avalon.logging.update</td>
- <td>0</td>
<td>
If the value is larger than zero, the <strong>update</strong> is
how many millisecond between re-configuring the logging system. Not
all logging system will support this property, in which case it is
- completely ignored.
+ completely ignored. The default value is 0.
</td>
</tr>
</table>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/index.xml Tue Jun 15 08:42:30 2004
@@ -7,7 +7,6 @@
<body>
<section name="Avalon Logging">
- <subsection name="Overview">
<p>
The Avalon Logging system is a container-side service that defines
a framework for the logging system plugins. The framework is
@@ -32,7 +31,6 @@
Alternative strategies include the <a href="logkit/index.html">Log4J</a>
implementation.
</p>
- </subsection>
</section>
</body>
</document>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/log4j/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/log4j/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/log4j/index.xml Tue Jun 15 08:42:30 2004
@@ -24,7 +24,6 @@
</properties>
<body>
<section name="Avalon Log4J Logging Plugin">
- <subsection name="Overview">
<p>
The Log4J plugin for Avalon Logging allows for the usage of
Apache Log4J log system to be driving your Avalon application.
@@ -51,7 +50,6 @@
<p>
where VERSION in this case identifies the Log4J version to be used.
</p>
- </subsection>
<subsection name="Properties">
<p>
See the <a href="../../spec/index.html">Specification</a> for full
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/index.xml Tue Jun 15 08:42:30 2004
@@ -20,391 +20,41 @@
<title>Logkit - Whitepaper</title>
</properties>
<body>
- <section name="Abstract">
- <p>
- Logging is an integral component to any software development project.
- During the development stages it offers a valuable source of debugging
- information for the developer. During deployment it can provide
- valuable operational data that allows administrators to diagnose
- problems as they arise. This whitepaper describes the design and
- implementation of LogKit.
- </p>
- </section>
- <section name="Introduction">
- <p>
- LogKit, began life as a facade for a more complex logging toolkit.
- During development it was found that existing toolkits were complex and
- difficult to use. A malformed logger configuration file could cause the
- whole system to fail or the logging information to go into the void.
- </p>
- <p>
- Over time it was discovered that the facade, while simple to use,
- inherited many of the faults of the underlying logging toolkit. The
- logging was slow and was impossible to dynamically reconfigure.
- </p>
- <p>
- At this time the whole system was overhauled. Existing logging toolkits
- were surveyed and user feedback was gathered from both developers and
- administrators. The new toolkit focused on speed, reliability and
- dynamic reconfiguration. It then added, at that time unique features,
- for filtering log events, multiple listeners (aka LogTargets) per
- category and delayed serialization of events.
- </p>
- </section>
- <section name="Structure and Elements">
- <p>
- The most basic components of LogKit are the Logger, the LogEvent and the
- LogTarget. The Logger represents the client interface to the logging
- system. The developer interacts with Logger to generate LogEvents. The
- LogEvents are routed to a LogTarget. The LogTarget decides what to do
- with the LogEvent, usually it is recorded to a file, a database or
- transmitted over the network.
- </p>
- </section>
- <section name="Priorities">
- <p>
- One of the advantages of a logging toolkit is fine grain control over
- which statements get printed. At some times during development you may
- wish to enable all logging statements and at other times they may wish
- to disable debug messages. It was from this need that the notion of of
- Priorities were born. A Priority describes the urgency of a LogEvent.
- Below is a list of priorities that are usable within the LogKit system
- (extracted from the constants of class org.apache.log.Priority).
- </p>
- <ul>
- <li>
- <strong>DEBUG:</strong>
- <br/>
- Developer oriented messages, usually used during development of the
- product.
- </li>
- <li>
- <strong>INFO:</strong>
- <br/>
- Useful information messages such as state changes, client connection,
- user login etc.
- </li>
- <li>
- <strong>WARN:</strong>
- <br/>
- A problem or conflict has occurred but it may be recoverable, then
- again it could be the start of the system failing.
- </li>
- <li>
- <strong>ERROR:</strong>
- <br/>
- A problem has occurred but it is not fatal. The system will still
- function.
- </li>
- <li>
- <strong>FATAL_ERROR:</strong>
- <br/>
- Something caused whole system to fail. This indicates that an
- administrator should restart the system and try to fix the problem
- that caused the failure.
- </li>
- </ul>
- <p>
- The range of priorities is limited by design as past experience has
- indicated more levels do not offer any significant advantage to the
- user.
- </p>
- <p>
- Each logger instance is associated with a Priority. This allows you to
- limit each logger so that it only displays messages greater than a
- certain priority. So if a DEBUG message occurred and the logger's
- priority was WARN, the LogEvent would be suppressed.
- </p>
- <p>
- A user can log at a certain priority by calling a method with matching
- name and the message as a string. For instance to log at debug level
- you would call logger.debug("My Message"). Similar methods exist for
- info(), warn() and error(). There is also a set of similarly named
- methods that take both a message string and an exception.
- </p>
- <p>
- Where performance is critical it is often useful to check if a priority
- is enabled before constructing the message. In many cases the
- construction of the message is an expensive string operation and
- conversion operation. In this case it is useful to know before you
- create the message whether it will be logged. The pattern of the method
- to check if a priority is enabled is "is<Priority>Enabled()". An
- example use case is displayed below.
- </p>
- <source>
-if( logger.isDebugEnabled() )
-{
- //Construct a message (expensive operation)
- final String message = "Var1 value: " + var1 + "\tVar2 value: " + var2 +
- "\tVar3 value: " + var3 + ".";
- logger.debug( message );
-}
- </source>
- </section>
- <section name="Categories">
- <p>
- In a complex system it is often not enough to suppress logging based on
- priority. For instance you may wish to log the network subsystem with
- DEBUG priority while the simulator subsystem with WARN priority. To
- accomplish this LogKit uses a concept termed Categories. Categories,
- often called Channels, Subjects or Facilities, are a subdivision of the
- logging namespace.
- </p>
- <p>
- Each category is a name, made up of name components separated by a ".".
- So a category named "network.interceptor.connected" is made up of three
- name components "network", "interceptor" and "connected", ordered from
- left to right. Every logger is associated with a category at creation.
- </p>
- <p>
- LogKit takes it one step further and assumes that the namespace is
- hierarchical. The left-most name component is the most generic category
- while the right-most name component is the most specific. So
- "network.interceptor.connected" is a child category of
- "network.interceptor", which is in turn a child category of "network".
- There is also a root category "" that is hidden inside the
- org.apache.log.Hierarchy class.
- </p>
- <p>
- The main reason for structuring logging namespace in a hierarchical
- manner is to allow inheritance. A logger will inherit it's parent
- priority if it has not been explicitly set. This allows you to set the
- "network" logger to have INFO priority and unless the
- "network.interceptor" has had it's priority set it will inherit the
- INFO priority.
- </p>
- <p>
- Unlike other logging toolkits, there is no performance penalty for
- having deep hierarchies. Each logger caches a Priority to check against.
- When a logger has it's logger set or unset, it updates the cached
- version of it's child loggers.
- </p>
- </section>
- <section name="Log Targets">
- <p>
- In LogKit, LogTargets are the destination of LogEvents. Decoupling
- LogEvent generation from handling allows developers to change
- destinations of LogEvents dynamically or via configuration files.
- Possible destinations include writing to a database, a file, an IRC
- channel, a syslog server, an instant messaging client etc.
- </p>
- <p>
- Like Priorities, it is often useful to allow LogTargets to be inherited
- between loggers. Like Priority inheritance, LogTarget inheritance does
- not suffer any runtime performance penalty.
- </p>
- <section name="Filters">
- <p>
- Filters are a special kind of LogTarget. Instead of writing to an
- output destination they are used to filter out LogEvents or modify
- the LogEvents details and pass it on to another LogTarget.
- </p>
- <p>
- This can be a useful feature when you assign multiple LogTargets to a
- logger. For instance you may add two LogTargets to a logger, one which
- writes LogEvents to a database and one which writes a message to the
- administrators pager. However you may want to record all messages to
- the database but only transmit FATAL_ERROR messages to pager. In this
- case you would use a PriorityFilter to filter out non-FATAL_ERROR
- messages for pager log target.
- </p>
- </section>
- <section name="AsyncLogTarget">
- <p>
- AsyncLogTarget is another kind of special LogTarget. It takes a log
- event and copies it into a queue so that another thread can actually
- write the LogEvent to another LogTarget. This is useful if logging to
- a particular LogTarget is a slow operation (such as a MailLogTarget).
- </p>
- <p>
- Below is a snippet of code that creates an AsyncLogTarget to write
- messages in another thread.
- </p>
- <source>
-LogTarget mySlowTarget = ...;
-AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
-Thread thread = new Thread( asyncTarget );
-thread.setPriority( Thread.MIN_PRIORITY );
-thread.start();
-logger.setLogTargets( new LogTarget[] { asyncTarget } );
- </source>
- </section>
- </section>
- <section name="Formatters">
- <p>
- LogTargets that write to a serial or unstructured store (ie filesystem
- or network based LogTargets) need some method to serialize the LogEvent
- before writing to the store. The most common way to serialize the
- LogEvent is to use a Formatter.
- </p>
- <p>
- The Formatter interface takes a LogEvent and returns a String object.
- The most commonly use LogEvent is the PatternFormatter. The pattern
- formatter takes a format specifier that has a similar format to c's
- printf function.
- </p>
- <p>
- The format specifier consists of a string containing raw text combined
- with pattern elements. Each pattern element has the generalized form
- "%[+|-]#.#{field:subformat}". The +|- indicates whether the pattern
- element should be left or right justified (defaults to left justified if
- unspecified). The #.# indicates the minimum and maximum size of output,
- if unspecified the output is neither padded nor truncated. 'field'
- indicates the field to be written and must be one of "category",
- "context", "message", "time", "rtime" (time relative to start of
- application), "throwable" or "priority". This parameter must be supplied
- and correlates to fields of LogEvent. 'subformat' is currently unused
- except in the case of "context" field. This is further discussed below.
- </p>
- <p>
- Following is a number of examples for PatternFormatter's format
- specifier and actual output.
- </p>
- <source>
-format: "%7.7{priority} %5.5{rtime} [%8.8{category}]: %{message}\n%{throwable}"
-output: DEBUG 123 [network.]: This is a debug message
-format: "%7.7{priority} %5.5{rtime} [%{category}]: %{message}\n"
-output: DEBUG 123 [network.interceptor.connected]: This is a debug message
-output: DEBUG 123 [network]: This is another debug message
-format: "%7.7{priority} %5.5{rtime} [%10.{category}]: %{message}\n"
-output: DEBUG 123 [network.interceptor.connected]: This is a debug message
-output: DEBUG 123 [network ]: This is another debug message
- </source>
- <p>
- There is also ExtendedPatternFormatter that allows two extra fields,
- namely "method" and "thread". The "method" field attempts to determine
- the method that called the Logger method to generate the LogEvent. The
- "thread" field displays the name of the current thread.
- </p>
- </section>
- <section name="Context">
- <p>
- In many systems you need to include extra information depending in logs
- that depends on information not included in the LogEvent. For instance
- the Formatters section described an ExtendedPatternFormatter that
- included information such as calling method and calling thread. Other
- contextual information that you may need to include in log files include
- user executing log statement, the network interface that the client
- component is listening to (ie 127.0.0.1 vs 192.168.1.1), hostname
- (especially important on multihomed boxs) or source of LogEvent (useful
- when writing a centralized log server).
- </p>
- <p>
- There are a number of strategies to deal with application specific
- contextual information. Some logging toolkits encourage extending the
- Logger, LogEvent and LogTargets while others encourage using application
- specific LogTargets. The way that LogKit solves this problem is by using
- a generic ContexMap object.
- </p>
- <p>
- The ContextMap allows the user to store arbitrary objects using a string
- key. These objects can then be extracted by the LogTargets and used as
- appropriate. If you were using the PatternFormatter you could extract a
- value from ContextMap by specify the "context" field with it's subformat
- set to the appropriate key. Some examples are illustrated below.
- </p>
- <source>
-format: "%7.7{priority} [%{context:hostname}]: %{message}\n"
-output: DEBUG [helm.realityforge.org]: This is a debug message
-format: "%7.7{priority} [%{context:interface}]: %{message}\n"
-output: DEBUG [127.0.0.1]: This is logging about loopback interface
-output: DEBUG [192.168.1.1]: This is logging about internal network interface
-output: DEBUG [203.121.1.2]: This is logging about external network interface
-format: "%7.7{priority} [%{context:user}]: %{message}\n"
-output: DEBUG [Barney Rubble]: This is a debug message
- </source>
- <p>
- <em>Warning:</em>
- Older versions of LogKit also incorporated a ContextStack that offered
- hierarchical management of context. It was discovered that this design
- encouraged bad practices and thus use of this feature has been
- deprecated in favour of using ContextMap. The ContextStack is still
- accessible if users do not specify a subformat or specify the subformat
- "stack". However it is strongly advised that users do not use this
- feature as it will be removed in a future iteration.
- </p>
- <p>
- When using a ContextMap you create the object and populate it using the
- set(key,value) method. After populating the ContextMap you call the
- method makeReadOnly(). This makes it impossible for hostile code to
- modify context in which logging occurs.
- </p>
- <p>
- Then you need to associate the ContextMap with a thread by using
- ContextMap.bind( myContextMap ). The ContextMap is bound to a thread
- using java.lang.InheritableThreadLocal and thus maps are inherited
- between threads as specified by InheritableThreadLocal.
- </p>
- <p>Below is an example of how a user can create and bind a ContextMap.</p>
- <source>
-final ContextMap context = new ContextMap();
-context.set( "user", "Fred Flinstone" );
-context.set( "interface", myInterface );
-context.set( "hostname", "helm.realityforge.org" );
-context.set( "jvmid", myJvmId );
-context.makeReadOnly();
-//bind new ContextMap to current thread and subthreads
-ContextMap.bind( context );
- </source>
- </section>
- <section name="Examples" >
- <p>
- One of the best ways to learn how to use a toolkit is to see an
- example in action. With that heres some example uses of LogKit. The
- first example is in a simple application while the next example is in a
- servlet. The servlet example demonstrates the usage of filters.
- </p>
- <source>
-Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("myCategory");
-logger.setPriority( Priority.DEBUG );
-logger.debug( "This is a debug message" );
- </source>
- <source>
-//Create a Log filter that writes to servlet Containers log
-//If priority greater than ERROR
-PriorityFilter filter = new PriorityFilter(Priority.ERROR);
-filter.addTarget( new ServletOutputLogTarget(context) );
-
-String logName = getInitParameter("log-name");
-if( null == logName )
- logName = "myservlet.log";
-
-final String path = context.getRealPath("/") + "/WEB-INF/logs/" + logName ;
-
-//Create a logger to write to a file as specified
-//with servlet init parameters
-final String pattern = "%7.7{priority} %5.5{time} [%8.8{category}] " +
- "(%{context}): %{message}\\n%{throwable}";
-
-final PatternFormatter formatter = new PatternFormatter( pattern );
-final File file = new File( path );
-
-//open file target in append mode
-FileTarget target = new FileTarget( file, true, formatter );
-
-//Create logger
-myLogger = Hierarchy.getDefaultHierarchy().getLoggerFor("myServlet");
-
-//Set log targets of logger
-myLogger.setLogTargets( new LogTarget[] { target, filter } );
-String logLevel = getInitParameter("log-priority");
-
-if( null == logLevel )
- logLevel = "DEBUG";
-
-//Set log targets parameter based on init parameters
-Priority priority = Priority.getPriorityForName( logLevel );
-myLogger.setPriority( priority );
- </source>
- </section>
- <section name="Conclusion">
- <p>
- LogKit is a friendly, easy to use logging toolkit. It is high
- performing and easily integrated into existing products. By design it
- does not specify any configuration format but instead encourages users
- to integrate it into their existing products. It also is designed to run
- in a secure environment by limiting client access to hierarchies.
- </p>
- </section>
+ <section name="Avalon Logging LogKit Plugin">
+ <p>The LogKit provides the following features:</p>
+ <ul>
+ <li>Decouples LogEvent generation from LogEvent handling.</li>
+ <li>Is simple to use and simple to configure.</li>
+ <li>Designed with security in mind.</li>
+ <li>
+ Allow users fine control of logging based on priority and/or
+ category.
+ </li>
+ <li>
+ Has hierarchical logging namespace to enable inheritance of
+ LogTargets and Priorities.
+ </li>
+ <li>Lightweight.</li>
+ <li>Designed to be integrated into existing products.</li>
+ <li>Performance oriented.</li>
+ <li>
+ Enables users to plug in filters to filter out or modify LogEvents
+ before they are written out.
+ </li>
+ <li>
+ Allow users to specify the serialization format of LogEvents via
+ Formatters.
+ </li>
+ <li>
+ Comes with a number of existing LogTargets to ease
+ integration.
+ </li>
+ <li>
+ The LogKit has existed for a number years and been used in a number
+ of different environments which demonstrates it's reliability and
+ stability.
+ </li>
+ </ul>
+ </section>
</body>
</document>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/navigation.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/navigation.xml Tue Jun 15 08:42:30 2004
@@ -21,7 +21,7 @@
<body>
<menu>
- <item name="Features" href="features.html"/>
+ <item name="Whitepaper" href="whitepaper.html"/>
<item name="Configuration" href="targets/index.html"/>
<item name="Examples" href="examples/index.html"/>
</menu>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/whitepaper.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/whitepaper.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/logging/logkit/whitepaper.xml Tue Jun 15 08:42:30 2004
@@ -20,391 +20,333 @@
<title>Logkit - Whitepaper</title>
</properties>
<body>
- <section name="Abstract">
- <p>
- Logging is an integral component to any software development project.
- During the development stages it offers a valuable source of debugging
- information for the developer. During deployment it can provide
- valuable operational data that allows administrators to diagnose
- problems as they arise. This whitepaper describes the design and
- implementation of LogKit.
- </p>
- </section>
- <section name="Introduction">
- <p>
- LogKit, began life as a facade for a more complex logging toolkit.
- During development it was found that existing toolkits were complex and
- difficult to use. A malformed logger configuration file could cause the
- whole system to fail or the logging information to go into the void.
- </p>
- <p>
- Over time it was discovered that the facade, while simple to use,
- inherited many of the faults of the underlying logging toolkit. The
- logging was slow and was impossible to dynamically reconfigure.
- </p>
- <p>
- At this time the whole system was overhauled. Existing logging toolkits
- were surveyed and user feedback was gathered from both developers and
- administrators. The new toolkit focused on speed, reliability and
- dynamic reconfiguration. It then added, at that time unique features,
- for filtering log events, multiple listeners (aka LogTargets) per
- category and delayed serialization of events.
- </p>
- </section>
- <section name="Structure and Elements">
- <p>
- The most basic components of LogKit are the Logger, the LogEvent and the
- LogTarget. The Logger represents the client interface to the logging
- system. The developer interacts with Logger to generate LogEvents. The
- LogEvents are routed to a LogTarget. The LogTarget decides what to do
- with the LogEvent, usually it is recorded to a file, a database or
- transmitted over the network.
- </p>
- </section>
- <section name="Priorities">
- <p>
- One of the advantages of a logging toolkit is fine grain control over
- which statements get printed. At some times during development you may
- wish to enable all logging statements and at other times they may wish
- to disable debug messages. It was from this need that the notion of of
- Priorities were born. A Priority describes the urgency of a LogEvent.
- Below is a list of priorities that are usable within the LogKit system
- (extracted from the constants of class org.apache.log.Priority).
- </p>
- <ul>
- <li>
- <strong>DEBUG:</strong>
- <br/>
- Developer oriented messages, usually used during development of the
- product.
- </li>
- <li>
- <strong>INFO:</strong>
- <br/>
- Useful information messages such as state changes, client connection,
- user login etc.
- </li>
- <li>
- <strong>WARN:</strong>
- <br/>
- A problem or conflict has occurred but it may be recoverable, then
- again it could be the start of the system failing.
- </li>
- <li>
- <strong>ERROR:</strong>
- <br/>
- A problem has occurred but it is not fatal. The system will still
- function.
- </li>
- <li>
- <strong>FATAL_ERROR:</strong>
- <br/>
- Something caused whole system to fail. This indicates that an
- administrator should restart the system and try to fix the problem
- that caused the failure.
- </li>
- </ul>
- <p>
- The range of priorities is limited by design as past experience has
- indicated more levels do not offer any significant advantage to the
- user.
- </p>
- <p>
- Each logger instance is associated with a Priority. This allows you to
- limit each logger so that it only displays messages greater than a
- certain priority. So if a DEBUG message occurred and the logger's
- priority was WARN, the LogEvent would be suppressed.
- </p>
- <p>
- A user can log at a certain priority by calling a method with matching
- name and the message as a string. For instance to log at debug level
- you would call logger.debug("My Message"). Similar methods exist for
- info(), warn() and error(). There is also a set of similarly named
- methods that take both a message string and an exception.
- </p>
- <p>
- Where performance is critical it is often useful to check if a priority
- is enabled before constructing the message. In many cases the
- construction of the message is an expensive string operation and
- conversion operation. In this case it is useful to know before you
- create the message whether it will be logged. The pattern of the method
- to check if a priority is enabled is "is<Priority>Enabled()". An
- example use case is displayed below.
- </p>
- <source>
-if( logger.isDebugEnabled() )
-{
- //Construct a message (expensive operation)
- final String message = "Var1 value: " + var1 + "\tVar2 value: " + var2 +
- "\tVar3 value: " + var3 + ".";
- logger.debug( message );
-}
- </source>
- </section>
- <section name="Categories">
- <p>
- In a complex system it is often not enough to suppress logging based on
- priority. For instance you may wish to log the network subsystem with
- DEBUG priority while the simulator subsystem with WARN priority. To
- accomplish this LogKit uses a concept termed Categories. Categories,
- often called Channels, Subjects or Facilities, are a subdivision of the
- logging namespace.
- </p>
- <p>
- Each category is a name, made up of name components separated by a ".".
- So a category named "network.interceptor.connected" is made up of three
- name components "network", "interceptor" and "connected", ordered from
- left to right. Every logger is associated with a category at creation.
- </p>
- <p>
- LogKit takes it one step further and assumes that the namespace is
- hierarchical. The left-most name component is the most generic category
- while the right-most name component is the most specific. So
- "network.interceptor.connected" is a child category of
- "network.interceptor", which is in turn a child category of "network".
- There is also a root category "" that is hidden inside the
- org.apache.log.Hierarchy class.
- </p>
- <p>
- The main reason for structuring logging namespace in a hierarchical
- manner is to allow inheritance. A logger will inherit it's parent
- priority if it has not been explicitly set. This allows you to set the
- "network" logger to have INFO priority and unless the
- "network.interceptor" has had it's priority set it will inherit the
- INFO priority.
- </p>
- <p>
- Unlike other logging toolkits, there is no performance penalty for
- having deep hierarchies. Each logger caches a Priority to check against.
- When a logger has it's logger set or unset, it updates the cached
- version of it's child loggers.
- </p>
- </section>
- <section name="Log Targets">
- <p>
- In LogKit, LogTargets are the destination of LogEvents. Decoupling
- LogEvent generation from handling allows developers to change
- destinations of LogEvents dynamically or via configuration files.
- Possible destinations include writing to a database, a file, an IRC
- channel, a syslog server, an instant messaging client etc.
- </p>
- <p>
- Like Priorities, it is often useful to allow LogTargets to be inherited
- between loggers. Like Priority inheritance, LogTarget inheritance does
- not suffer any runtime performance penalty.
- </p>
- <section name="Filters">
- <p>
- Filters are a special kind of LogTarget. Instead of writing to an
- output destination they are used to filter out LogEvents or modify
- the LogEvents details and pass it on to another LogTarget.
- </p>
- <p>
- This can be a useful feature when you assign multiple LogTargets to a
- logger. For instance you may add two LogTargets to a logger, one which
- writes LogEvents to a database and one which writes a message to the
- administrators pager. However you may want to record all messages to
- the database but only transmit FATAL_ERROR messages to pager. In this
- case you would use a PriorityFilter to filter out non-FATAL_ERROR
- messages for pager log target.
- </p>
- </section>
- <section name="AsyncLogTarget">
- <p>
- AsyncLogTarget is another kind of special LogTarget. It takes a log
- event and copies it into a queue so that another thread can actually
- write the LogEvent to another LogTarget. This is useful if logging to
- a particular LogTarget is a slow operation (such as a MailLogTarget).
- </p>
- <p>
- Below is a snippet of code that creates an AsyncLogTarget to write
- messages in another thread.
- </p>
- <source>
-LogTarget mySlowTarget = ...;
-AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
-Thread thread = new Thread( asyncTarget );
-thread.setPriority( Thread.MIN_PRIORITY );
-thread.start();
-logger.setLogTargets( new LogTarget[] { asyncTarget } );
- </source>
- </section>
- </section>
- <section name="Formatters">
- <p>
- LogTargets that write to a serial or unstructured store (ie filesystem
- or network based LogTargets) need some method to serialize the LogEvent
- before writing to the store. The most common way to serialize the
- LogEvent is to use a Formatter.
- </p>
- <p>
- The Formatter interface takes a LogEvent and returns a String object.
- The most commonly use LogEvent is the PatternFormatter. The pattern
- formatter takes a format specifier that has a similar format to c's
- printf function.
- </p>
- <p>
- The format specifier consists of a string containing raw text combined
- with pattern elements. Each pattern element has the generalized form
- "%[+|-]#.#{field:subformat}". The +|- indicates whether the pattern
- element should be left or right justified (defaults to left justified if
- unspecified). The #.# indicates the minimum and maximum size of output,
- if unspecified the output is neither padded nor truncated. 'field'
- indicates the field to be written and must be one of "category",
- "context", "message", "time", "rtime" (time relative to start of
- application), "throwable" or "priority". This parameter must be supplied
- and correlates to fields of LogEvent. 'subformat' is currently unused
- except in the case of "context" field. This is further discussed below.
- </p>
- <p>
- Following is a number of examples for PatternFormatter's format
- specifier and actual output.
- </p>
- <source>
-format: "%7.7{priority} %5.5{rtime} [%8.8{category}]: %{message}\n%{throwable}"
-output: DEBUG 123 [network.]: This is a debug message
-format: "%7.7{priority} %5.5{rtime} [%{category}]: %{message}\n"
-output: DEBUG 123 [network.interceptor.connected]: This is a debug message
-output: DEBUG 123 [network]: This is another debug message
-format: "%7.7{priority} %5.5{rtime} [%10.{category}]: %{message}\n"
-output: DEBUG 123 [network.interceptor.connected]: This is a debug message
-output: DEBUG 123 [network ]: This is another debug message
- </source>
- <p>
- There is also ExtendedPatternFormatter that allows two extra fields,
- namely "method" and "thread". The "method" field attempts to determine
- the method that called the Logger method to generate the LogEvent. The
- "thread" field displays the name of the current thread.
- </p>
- </section>
- <section name="Context">
- <p>
- In many systems you need to include extra information depending in logs
- that depends on information not included in the LogEvent. For instance
- the Formatters section described an ExtendedPatternFormatter that
- included information such as calling method and calling thread. Other
- contextual information that you may need to include in log files include
- user executing log statement, the network interface that the client
- component is listening to (ie 127.0.0.1 vs 192.168.1.1), hostname
- (especially important on multihomed boxs) or source of LogEvent (useful
- when writing a centralized log server).
- </p>
- <p>
- There are a number of strategies to deal with application specific
- contextual information. Some logging toolkits encourage extending the
- Logger, LogEvent and LogTargets while others encourage using application
- specific LogTargets. The way that LogKit solves this problem is by using
- a generic ContexMap object.
- </p>
- <p>
- The ContextMap allows the user to store arbitrary objects using a string
- key. These objects can then be extracted by the LogTargets and used as
- appropriate. If you were using the PatternFormatter you could extract a
- value from ContextMap by specify the "context" field with it's subformat
- set to the appropriate key. Some examples are illustrated below.
- </p>
- <source>
-format: "%7.7{priority} [%{context:hostname}]: %{message}\n"
-output: DEBUG [helm.realityforge.org]: This is a debug message
-format: "%7.7{priority} [%{context:interface}]: %{message}\n"
-output: DEBUG [127.0.0.1]: This is logging about loopback interface
-output: DEBUG [192.168.1.1]: This is logging about internal network interface
-output: DEBUG [203.121.1.2]: This is logging about external network interface
-format: "%7.7{priority} [%{context:user}]: %{message}\n"
-output: DEBUG [Barney Rubble]: This is a debug message
- </source>
- <p>
- <em>Warning:</em>
- Older versions of LogKit also incorporated a ContextStack that offered
- hierarchical management of context. It was discovered that this design
- encouraged bad practices and thus use of this feature has been
- deprecated in favour of using ContextMap. The ContextStack is still
- accessible if users do not specify a subformat or specify the subformat
- "stack". However it is strongly advised that users do not use this
- feature as it will be removed in a future iteration.
- </p>
- <p>
- When using a ContextMap you create the object and populate it using the
- set(key,value) method. After populating the ContextMap you call the
- method makeReadOnly(). This makes it impossible for hostile code to
- modify context in which logging occurs.
- </p>
- <p>
- Then you need to associate the ContextMap with a thread by using
- ContextMap.bind( myContextMap ). The ContextMap is bound to a thread
- using java.lang.InheritableThreadLocal and thus maps are inherited
- between threads as specified by InheritableThreadLocal.
- </p>
- <p>Below is an example of how a user can create and bind a ContextMap.</p>
- <source>
-final ContextMap context = new ContextMap();
-context.set( "user", "Fred Flinstone" );
-context.set( "interface", myInterface );
-context.set( "hostname", "helm.realityforge.org" );
-context.set( "jvmid", myJvmId );
-context.makeReadOnly();
-//bind new ContextMap to current thread and subthreads
-ContextMap.bind( context );
- </source>
- </section>
- <section name="Examples" >
- <p>
- One of the best ways to learn how to use a toolkit is to see an
- example in action. With that heres some example uses of LogKit. The
- first example is in a simple application while the next example is in a
- servlet. The servlet example demonstrates the usage of filters.
- </p>
- <source>
-Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("myCategory");
-logger.setPriority( Priority.DEBUG );
-logger.debug( "This is a debug message" );
- </source>
- <source>
-//Create a Log filter that writes to servlet Containers log
-//If priority greater than ERROR
-PriorityFilter filter = new PriorityFilter(Priority.ERROR);
-filter.addTarget( new ServletOutputLogTarget(context) );
-
-String logName = getInitParameter("log-name");
-if( null == logName )
- logName = "myservlet.log";
-
-final String path = context.getRealPath("/") + "/WEB-INF/logs/" + logName ;
-
-//Create a logger to write to a file as specified
-//with servlet init parameters
-final String pattern = "%7.7{priority} %5.5{time} [%8.8{category}] " +
- "(%{context}): %{message}\\n%{throwable}";
-
-final PatternFormatter formatter = new PatternFormatter( pattern );
-final File file = new File( path );
-
-//open file target in append mode
-FileTarget target = new FileTarget( file, true, formatter );
-
-//Create logger
-myLogger = Hierarchy.getDefaultHierarchy().getLoggerFor("myServlet");
-
-//Set log targets of logger
-myLogger.setLogTargets( new LogTarget[] { target, filter } );
-String logLevel = getInitParameter("log-priority");
-
-if( null == logLevel )
- logLevel = "DEBUG";
-
-//Set log targets parameter based on init parameters
-Priority priority = Priority.getPriorityForName( logLevel );
-myLogger.setPriority( priority );
- </source>
- </section>
- <section name="Conclusion">
- <p>
- LogKit is a friendly, easy to use logging toolkit. It is high
- performing and easily integrated into existing products. By design it
- does not specify any configuration format but instead encourages users
- to integrate it into their existing products. It also is designed to run
- in a secure environment by limiting client access to hierarchies.
- </p>
- </section>
+ <section name="LogKit Whitepaper">
+ <p>
+ Logging is an integral component to any software development project.
+ During the development stages it offers a valuable source of debugging
+ information for the developer. During deployment it can provide
+ valuable operational data that allows administrators to diagnose
+ problems as they arise. This whitepaper describes the design and
+ implementation of LogKit.
+ </p>
+ <subsection name="Introduction">
+ <p>
+ LogKit, began life as a facade for a more complex logging toolkit.
+ During development it was found that existing toolkits were complex and
+ difficult to use. A malformed logger configuration file could cause the
+ whole system to fail or the logging information to go into the void.
+ </p>
+ <p>
+ Over time it was discovered that the facade, while simple to use,
+ inherited many of the faults of the underlying logging toolkit. The
+ logging was slow and was impossible to dynamically reconfigure.
+ </p>
+ <p>
+ At this time the whole system was overhauled. Existing logging toolkits
+ were surveyed and user feedback was gathered from both developers and
+ administrators. The new toolkit focused on speed, reliability and
+ dynamic reconfiguration. It then added, at that time unique features,
+ for filtering log events, multiple listeners (aka LogTargets) per
+ category and delayed serialization of events.
+ </p>
+ </subsection>
+ <subsection name="Structure and Elements">
+ <p>
+ The most basic components of LogKit are the Logger, the LogEvent and the
+ LogTarget. The Logger represents the client interface to the logging
+ system. The developer interacts with Logger to generate LogEvents. The
+ LogEvents are routed to a LogTarget. The LogTarget decides what to do
+ with the LogEvent, usually it is recorded to a file, a database or
+ transmitted over the network.
+ </p>
+ </subsection>
+ <subsection name="Priorities">
+ <p>
+ One of the advantages of a logging toolkit is fine grain control over
+ which statements get printed. At some times during development you may
+ wish to enable all logging statements and at other times they may wish
+ to disable debug messages. It was from this need that the notion of of
+ Priorities were born. A Priority describes the urgency of a LogEvent.
+ Below is a list of priorities that are usable within the LogKit system
+ (extracted from the constants of class org.apache.log.Priority).
+ </p>
+ <ul>
+ <li>
+ <strong>DEBUG:</strong>
+ <br/>
+ Developer oriented messages, usually used during development of the
+ product.
+ </li>
+ <li>
+ <strong>INFO:</strong>
+ <br/>
+ Useful information messages such as state changes, client connection,
+ user login etc.
+ </li>
+ <li>
+ <strong>WARN:</strong>
+ <br/>
+ A problem or conflict has occurred but it may be recoverable, then
+ again it could be the start of the system failing.
+ </li>
+ <li>
+ <strong>ERROR:</strong>
+ <br/>
+ A problem has occurred but it is not fatal. The system will still
+ function.
+ </li>
+ <li>
+ <strong>FATAL_ERROR:</strong>
+ <br/>
+ Something caused whole system to fail. This indicates that an
+ administrator should restart the system and try to fix the problem
+ that caused the failure.
+ </li>
+ </ul>
+ <p>
+ The range of priorities is limited by design as past experience has
+ indicated more levels do not offer any significant advantage to the
+ user.
+ </p>
+ <p>
+ Each logger instance is associated with a Priority. This allows you to
+ limit each logger so that it only displays messages greater than a
+ certain priority. So if a DEBUG message occurred and the logger's
+ priority was WARN, the LogEvent would be suppressed.
+ </p>
+ <p>
+ A user can log at a certain priority by calling a method with matching
+ name and the message as a string. For instance to log at debug level
+ you would call logger.debug("My Message"). Similar methods exist for
+ info(), warn() and error(). There is also a set of similarly named
+ methods that take both a message string and an exception.
+ </p>
+ <p>
+ Where performance is critical it is often useful to check if a priority
+ is enabled before constructing the message. In many cases the
+ construction of the message is an expensive string operation and
+ conversion operation. In this case it is useful to know before you
+ create the message whether it will be logged. The pattern of the method
+ to check if a priority is enabled is "is<Priority>Enabled()". An
+ example use case is displayed below.
+ </p>
+ <source>
+if( logger.isDebugEnabled() )
+{
+ //Construct a message (expensive operation)
+ final String message = "Var1 value: " + var1 + "\tVar2 value: " + var2 +
+ "\tVar3 value: " + var3 + ".";
+ logger.debug( message );
+}
+ </source>
+ </subsection>
+ <subsection name="Categories">
+ <p>
+ In a complex system it is often not enough to suppress logging based on
+ priority. For instance you may wish to log the network subsystem with
+ DEBUG priority while the simulator subsystem with WARN priority. To
+ accomplish this LogKit uses a concept termed Categories. Categories,
+ often called Channels, Subjects or Facilities, are a subdivision of the
+ logging namespace.
+ </p>
+ <p>
+ Each category is a name, made up of name components separated by a ".".
+ So a category named "network.interceptor.connected" is made up of three
+ name components "network", "interceptor" and "connected", ordered from
+ left to right. Every logger is associated with a category at creation.
+ </p>
+ <p>
+ LogKit takes it one step further and assumes that the namespace is
+ hierarchical. The left-most name component is the most generic category
+ while the right-most name component is the most specific. So
+ "network.interceptor.connected" is a child category of
+ "network.interceptor", which is in turn a child category of "network".
+ There is also a root category "" that is hidden inside the
+ org.apache.log.Hierarchy class.
+ </p>
+ <p>
+ The main reason for structuring logging namespace in a hierarchical
+ manner is to allow inheritance. A logger will inherit it's parent
+ priority if it has not been explicitly set. This allows you to set the
+ "network" logger to have INFO priority and unless the
+ "network.interceptor" has had it's priority set it will inherit the
+ INFO priority.
+ </p>
+ <p>
+ Unlike other logging toolkits, there is no performance penalty for
+ having deep hierarchies. Each logger caches a Priority to check against.
+ When a logger has it's logger set or unset, it updates the cached
+ version of it's child loggers.
+ </p>
+ </subsection>
+ <subsection name="Log Targets">
+ <p>
+ In LogKit, LogTargets are the destination of LogEvents. Decoupling
+ LogEvent generation from handling allows developers to change
+ destinations of LogEvents dynamically or via configuration files.
+ Possible destinations include writing to a database, a file, an IRC
+ channel, a syslog server, an instant messaging client etc.
+ </p>
+ <p>
+ Like Priorities, it is often useful to allow LogTargets to be inherited
+ between loggers. Like Priority inheritance, LogTarget inheritance does
+ not suffer any runtime performance penalty.
+ </p>
+ </subsection>
+ <subsection name="Filters">
+ <p>
+ Filters are a special kind of LogTarget. Instead of writing to an
+ output destination they are used to filter out LogEvents or modify
+ the LogEvents details and pass it on to another LogTarget.
+ </p>
+ <p>
+ This can be a useful feature when you assign multiple LogTargets to a
+ logger. For instance you may add two LogTargets to a logger, one which
+ writes LogEvents to a database and one which writes a message to the
+ administrators pager. However you may want to record all messages to
+ the database but only transmit FATAL_ERROR messages to pager. In this
+ case you would use a PriorityFilter to filter out non-FATAL_ERROR
+ messages for pager log target.
+ </p>
+ </subsection>
+ <subsection name="AsyncLogTarget">
+ <p>
+ AsyncLogTarget is another kind of special LogTarget. It takes a log
+ event and copies it into a queue so that another thread can actually
+ write the LogEvent to another LogTarget. This is useful if logging to
+ a particular LogTarget is a slow operation (such as a MailLogTarget).
+ </p>
+ <p>
+ Below is a snippet of code that creates an AsyncLogTarget to write
+ messages in another thread.
+ </p>
+ <source>
+LogTarget mySlowTarget = ...;
+AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
+Thread thread = new Thread( asyncTarget );
+thread.setPriority( Thread.MIN_PRIORITY );
+thread.start();
+logger.setLogTargets( new LogTarget[] { asyncTarget } );
+ </source>
+ </subsection>
+ <subsection name="Formatters">
+ <p>
+ LogTargets that write to a serial or unstructured store (ie filesystem
+ or network based LogTargets) need some method to serialize the LogEvent
+ before writing to the store. The most common way to serialize the
+ LogEvent is to use a Formatter.
+ </p>
+ <p>
+ The Formatter interface takes a LogEvent and returns a String object.
+ The most commonly use LogEvent is the PatternFormatter. The pattern
+ formatter takes a format specifier that has a similar format to c's
+ printf function.
+ </p>
+ <p>
+ The format specifier consists of a string containing raw text combined
+ with pattern elements. Each pattern element has the generalized form
+ "%[+|-]#.#{field:subformat}". The +|- indicates whether the pattern
+ element should be left or right justified (defaults to left justified if
+ unspecified). The #.# indicates the minimum and maximum size of output,
+ if unspecified the output is neither padded nor truncated. 'field'
+ indicates the field to be written and must be one of "category",
+ "context", "message", "time", "rtime" (time relative to start of
+ application), "throwable" or "priority". This parameter must be supplied
+ and correlates to fields of LogEvent. 'subformat' is currently unused
+ except in the case of "context" field. This is further discussed below.
+ </p>
+ <p>
+ Following is a number of examples for PatternFormatter's format
+ specifier and actual output.
+ </p>
+ <source>
+format: "%7.7{priority} %5.5{rtime} [%8.8{category}]: %{message}\n%{throwable}"
+output: DEBUG 123 [network.]: This is a debug message
+format: "%7.7{priority} %5.5{rtime} [%{category}]: %{message}\n"
+output: DEBUG 123 [network.interceptor.connected]: This is a debug message
+output: DEBUG 123 [network]: This is another debug message
+format: "%7.7{priority} %5.5{rtime} [%10.{category}]: %{message}\n"
+output: DEBUG 123 [network.interceptor.connected]: This is a debug message
+output: DEBUG 123 [network ]: This is another debug message
+ </source>
+ <p>
+ There is also ExtendedPatternFormatter that allows two extra fields,
+ namely "method" and "thread". The "method" field attempts to determine
+ the method that called the Logger method to generate the LogEvent. The
+ "thread" field displays the name of the current thread.
+ </p>
+ </subsection>
+ <subsection name="Context">
+ <p>
+ In many systems you need to include extra information depending in logs
+ that depends on information not included in the LogEvent. For instance
+ the Formatters section described an ExtendedPatternFormatter that
+ included information such as calling method and calling thread. Other
+ contextual information that you may need to include in log files include
+ user executing log statement, the network interface that the client
+ component is listening to (ie 127.0.0.1 vs 192.168.1.1), hostname
+ (especially important on multihomed boxs) or source of LogEvent (useful
+ when writing a centralized log server).
+ </p>
+ <p>
+ There are a number of strategies to deal with application specific
+ contextual information. Some logging toolkits encourage extending the
+ Logger, LogEvent and LogTargets while others encourage using application
+ specific LogTargets. The way that LogKit solves this problem is by using
+ a generic ContexMap object.
+ </p>
+ <p>
+ The ContextMap allows the user to store arbitrary objects using a string
+ key. These objects can then be extracted by the LogTargets and used as
+ appropriate. If you were using the PatternFormatter you could extract a
+ value from ContextMap by specify the "context" field with it's subformat
+ set to the appropriate key. Some examples are illustrated below.
+ </p>
+ <source>
+format: "%7.7{priority} [%{context:hostname}]: %{message}\n"
+output: DEBUG [helm.realityforge.org]: This is a debug message
+format: "%7.7{priority} [%{context:interface}]: %{message}\n"
+output: DEBUG [127.0.0.1]: This is logging about loopback interface
+output: DEBUG [192.168.1.1]: This is logging about internal network interface
+output: DEBUG [203.121.1.2]: This is logging about external network interface
+format: "%7.7{priority} [%{context:user}]: %{message}\n"
+output: DEBUG [Barney Rubble]: This is a debug message
+ </source>
+ <p>
+ <em>Warning:</em>
+ Older versions of LogKit also incorporated a ContextStack that offered
+ hierarchical management of context. It was discovered that this design
+ encouraged bad practices and thus use of this feature has been
+ deprecated in favour of using ContextMap. The ContextStack is still
+ accessible if users do not specify a subformat or specify the subformat
+ "stack". However it is strongly advised that users do not use this
+ feature as it will be removed in a future iteration.
+ </p>
+ <p>
+ When using a ContextMap you create the object and populate it using the
+ set(key,value) method. After populating the ContextMap you call the
+ method makeReadOnly(). This makes it impossible for hostile code to
+ modify context in which logging occurs.
+ </p>
+ <p>
+ Then you need to associate the ContextMap with a thread by using
+ ContextMap.bind( myContextMap ). The ContextMap is bound to a thread
+ using java.lang.InheritableThreadLocal and thus maps are inherited
+ between threads as specified by InheritableThreadLocal.
+ </p>
+ <p>Below is an example of how a user can create and bind a ContextMap.</p>
+ <source>
+final ContextMap context = new ContextMap();
+context.set( "user", "Fred Flinstone" );
+context.set( "interface", myInterface );
+context.set( "hostname", "helm.realityforge.org" );
+context.set( "jvmid", myJvmId );
+context.makeReadOnly();
+//bind new ContextMap to current thread and subthreads
+ContextMap.bind( context );
+
+ </source>
+ </subsection>
+ </section>
</body>
</document>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/meta/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/meta/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/meta/index.xml Tue Jun 15 08:42:30 2004
@@ -9,7 +9,7 @@
<body>
- <section name="Avalon Meta Model">
+ <section name="Avalon Meta">
<table>
<tr><th>Subject</th><th>Description</th></tr>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/navigation.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/navigation.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/navigation.xml Tue Jun 15 08:42:30 2004
@@ -23,7 +23,6 @@
<body>
<menu>
<item name="Meta" href="meta/index.html"/>
- <item name="Framework" href="af4/index.html"/>
<item name="Composition" href="composition.html"/>
<item name="Activation" href="activation.html"/>
<item name="Repository" href="repository/index.html"/>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/bootstrap.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/bootstrap.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/bootstrap.xml Tue Jun 15 08:42:30 2004
@@ -45,44 +45,46 @@
<table>
<tr><th>Location</th></tr>
<tr>
- <td>${user.dir}/avalon.properties</td>
+ <td>${user.dir}/[name].properties</td>
</tr>
<tr>
- <td>${user.home}/avalon.properties</td>
+ <td>${user.home}/[name].properties</td>
</tr>
<tr>
- <td>${avalon.home}/avalon.properties</td>
+ <td>${avalon.home}/[name].properties</td>
</tr>
</table>
</subsection>
<subsection name="Bootstrap Properties">
<table>
- <tr><th>Property</th><th>Default Value</th><th>Description</th></tr>
+ <tr><th>Property</th><th>Description</th></tr>
<tr>
<td>avalon.repository.implementation</td>
- <td></td>
<td>The default implementation artifact specification. The bootstrap
system will atrempt to locate a value for this property when
the repository implementation. If no user supplied value can be
in the current working directory, ${user.home}, or ${avalon.home}
relative to an avalon.properties file, the implementation will
resolve the default implementation from an embeded avalon.properties
- resource.</td>
+ resource.
+ </td>
</tr>
<tr>
<td>avalon.repository.cache</td>
- <td>${avalon.home}</td>
<td>The default cache. In undefined in a property file, the value
defaults to an equivalent system property and if underfined, will
attempt to locate an environment variable AVALON_HOME. If the env
variable is not declared the default repository directory will
- revert to ${user.home}/.avalon.</td>
+ revert to ${user.home}/.avalon.
+ <source>Default: ${avalon.home}</source>
+ </td>
</tr>
<tr>
<td>avalon.repository.hosts</td>
- <td>http://dpml.net,http://ibiblio.org/maven</td>
<td>The default remote hosts expressed as a comma seperated
- sequence of host urls. File or http urls may be supplied.</td>
+ sequence of host urls. File or http urls may be supplied.
+ <source>Default: http://dpml.net,http://ibiblio.org/maven</source>
+ </td>
</tr>
</table>
</subsection>
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/repository/index.xml Tue Jun 15 08:42:30 2004
@@ -28,7 +28,7 @@
<body>
- <section name="About Avalon Repository">
+ <section name="Avalon Repository">
<p>
The Avalon Repository is a Java <a href="api/index.html">API</a>,
Modified: avalon/trunk/central/site/src/xdocs/products/runtime/system/util/index.xml
==============================================================================
--- avalon/trunk/central/site/src/xdocs/products/runtime/system/util/index.xml (original)
+++ avalon/trunk/central/site/src/xdocs/products/runtime/system/util/index.xml Tue Jun 15 08:42:30 2004
@@ -28,7 +28,7 @@
<body>
- <section name="About Avalon Utilities">
+ <section name="Avalon Utilities">
<p>
Welcome to the Avalon Utilities Home Page.
</p>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.