001: /*
002: * Copyright 2005-2007 Noelios Consulting.
003: *
004: * The contents of this file are subject to the terms of the Common Development
005: * and Distribution License (the "License"). You may not use this file except in
006: * compliance with the License.
007: *
008: * You can obtain a copy of the license at
009: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010: * language governing permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL HEADER in each file and
013: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014: * applicable, add the following below this CDDL HEADER, with the fields
015: * enclosed by brackets "[]" replaced with your own identifying information:
016: * Portions Copyright [yyyy] [name of copyright owner]
017: */
018:
019: package com.noelios.restlet.util;
020:
021: import java.io.IOException;
022:
023: /**
024: * Log file handler that uses the {@link AccessLogFormatter} by default. Also
025: * useful in configuration files to differentiate from the
026: * java.util.logging.FileHandler.
027: *
028: * @author Jerome Louvel (contact@noelios.com)
029: */
030: public class AccessLogFileHandler extends java.util.logging.FileHandler {
031: /**
032: * Constructor.
033: *
034: * @throws IOException
035: * @throws SecurityException
036: */
037: public AccessLogFileHandler() throws IOException, SecurityException {
038: super ();
039: init();
040: }
041:
042: /**
043: * Constructor.
044: *
045: * @param pattern
046: * The name of the output file.
047: * @throws IOException
048: * @throws SecurityException
049: */
050: public AccessLogFileHandler(String pattern) throws IOException,
051: SecurityException {
052: super (pattern);
053: init();
054: }
055:
056: /**
057: * Constructor.
058: *
059: * @param pattern
060: * The name of the output file.
061: * @param append
062: * Specifies append mode.
063: * @throws IOException
064: * @throws SecurityException
065: */
066: public AccessLogFileHandler(String pattern, boolean append)
067: throws IOException, SecurityException {
068: super (pattern, append);
069: init();
070: }
071:
072: /**
073: * Constructor.
074: *
075: * @param pattern
076: * The name of the output file.
077: * @param limit
078: * The maximum number of bytes to write to any one file.
079: * @param count
080: * The number of files to use.
081: * @throws IOException
082: * @throws SecurityException
083: */
084: public AccessLogFileHandler(String pattern, int limit, int count)
085: throws IOException, SecurityException {
086: super (pattern, limit, count);
087: init();
088: }
089:
090: /**
091: * Constructor.
092: *
093: * @param pattern
094: * The name of the output file.
095: * @param limit
096: * The maximum number of bytes to write to any one file.
097: * @param count
098: * The number of files to use.
099: * @param append
100: * Specifies append mode.
101: * @throws IOException
102: * @throws SecurityException
103: */
104: public AccessLogFileHandler(String pattern, int limit, int count,
105: boolean append) throws IOException, SecurityException {
106: super (pattern, limit, count, append);
107: init();
108: }
109:
110: /**
111: * Initialization code common to all constructors.
112: */
113: protected void init() {
114: setFormatter(new AccessLogFormatter());
115: }
116:
117: }
|