
Author: seb Date: Fri Sep 8 11:52:05 2006 New Revision: 534 Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RolloverFailure.java logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java Log: Updated javadoc Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java ============================================================================== --- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java (original) +++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java Fri Sep 8 11:52:05 2006 @@ -1,5 +1,5 @@ /** - * LOGBack: the reliable, fast and flexible logging library for Java. + * Logback: the reliable, generic, fast and flexible logging framework. * * Copyright (C) 1999-2006, QOS.ch * @@ -27,21 +27,20 @@ * <code>RollingPolicy</code> and a <code>TriggeringPolicy</code>. * * <p><code>RollingFileAppender</code> can be configured programattically or - * using {@link org.apache.log4j.joran.JoranConfigurator}. Here is a sample + * using {@link ch.qos.logback.classic.joran.JoranConfigurator}. Here is a sample * configration file: <pre><?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE log4j:configuration> -<log4j:configuration debug="true"> +<configuration debug="true"> - <appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender"> - <b><rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> + <appender name="ROLL" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <b><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/> </rollingPolicy></b> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%c{1} - %m%n"/> + <layout class="ch.qos.logback.classic.PatternLayout"> + <param name="Pattern" value="%c{1} - %m%n"/> </layout> </appender> @@ -49,7 +48,7 @@ <appender-ref ref="ROLL"/> </root> -</log4j:configuration> +</configuration> </pre> *<p>This configuration file specifies a monthly rollover schedule including Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RolloverFailure.java ============================================================================== --- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RolloverFailure.java (original) +++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/RolloverFailure.java Fri Sep 8 11:52:05 2006 @@ -1,17 +1,11 @@ -/* - * Copyright 1999,2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/** + * Logback: the reliable, generic, fast and flexible logging framework. + * + * Copyright (C) 1999-2006, QOS.ch + * + * This library is free software, you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation. */ package ch.qos.logback.core.rolling; Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java ============================================================================== --- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java (original) +++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java Fri Sep 8 11:52:05 2006 @@ -117,6 +117,32 @@ * </tr> * </table> * <p> + * <h2>Configuration example</h2> + * <p>Here is a complete logback configuration xml file that uses TimeBasedTriggeringPolicy. + * <p> + * <pre> + * <configuration> + * <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + * <b><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + * <param name="FileNamePattern" value="foo_%d{yyyy-MM}.log" /> + * <param name="ActiveFileName" value="foo.log" /> + * </rollingPolicy></b> + * <layout class="ch.qos.logback.classic.PatternLayout"> + * <param name="Pattern" value="%-4relative [%thread] %-5level %class - %msg%n" /> + * </layout> + * </appender> + * + * <root> + * <level value="debug" /> + * <appender-ref ref="FILE" /> + * </root> + * </configuration> + * </pre> + * <p> + * This configuration will produce output to a file called <code>foo.log</code>. For example, at the end of the month + * of September 2006, the file will be renamed to <code>foo_2006-09.log</code> and a new <code>foo.log</code> file + * will be created and used for actual logging. + * * @author Ceki Gülcü */ public class TimeBasedRollingPolicy extends RollingPolicyBase implements TriggeringPolicy {