001//  Copyright 2008 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5;
016
017import org.slf4j.Marker;
018import org.slf4j.MarkerFactory;
019
020import java.util.Arrays;
021
022/**
023 * A set of markers used internally by Tapestry when logging in code related to paqes and components. Most logging
024 * toolkits, including Log4J, do not incorporate markers, but  <a href="http://logback.qos.ch/">LOGBack</a> does.
025 */
026public class TapestryMarkers
027{
028    /**
029     * A root marker for all things Tapestry related. The remaining markers are children of the TAPESTRY marker.
030     */
031    public static final Marker TAPESTRY = MarkerFactory.getMarker("TAPESTRY");
032
033    /**
034     * Logs the final version of the class transformation. This is useful when debugging {@link
035     * org.apache.tapestry5.services.ComponentClassTransformWorker}s, as it shows exactly what transformation operations
036     * occured, at the Java code level.
037     */
038    public static final Marker CLASS_TRANSFORMATION = MarkerFactory.getMarker("CLASS_TRANSFORMATION");
039
040    /**
041     * Marker for a debug log that occurs just before invocation of a event handler method.
042     */
043    public static final Marker EVENT_HANDLER_METHOD = MarkerFactory.getMarker("EVENT_HANDLER_METHOD");
044
045    /**
046     * Marker for logging related to component event dispatch.
047     */
048    public static final Marker EVENT_DISPATCH = MarkerFactory.getMarker("EVENT_DISPATCH");
049
050    /**
051     * Marker for logging, at trace level verbose details about each individual {@link
052     * org.apache.tapestry5.runtime.RenderCommand} involved in rendering the page, as well as a final (debug level)
053     * summary of command count and elapsed time.
054     */
055
056    public static final Marker RENDER_COMMANDS = MarkerFactory.getMarker("RENDER_COMMANDS");
057
058    static
059    {
060        for (Marker child : Arrays.asList(CLASS_TRANSFORMATION, EVENT_HANDLER_METHOD, EVENT_DISPATCH, RENDER_COMMANDS))
061        {
062            TAPESTRY.add(child);
063        }
064    }
065}