// Path: winstone/src/main/java/net/winstone/accesslog/SimpleAccessLogger.java
// public final class SimpleAccessLogger implements AccessLogger {
// 	protected Logger logger = LoggerFactory.getLogger(getClass());
// 
// 	private final DateCache dateCache;
// 	private final String pattern;
// 	private PrintWriter outWriter;
// 
// 	/**
// 	 * 
// 	 * Build a new instance of SimpleAccessLogger.
// 	 * @param host
// 	 * @param webapp
// 	 * @param patternType
// 	 * @param filePattern
// 	 */
// 	SimpleAccessLogger(final String host, final String webapp, final PatternType patternType, final String filePattern) {
// 		super();
// 		dateCache = new DateCache(new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z"));
// 		pattern = patternType.getPattern();
// 		final String fileName = StringUtils.replace(filePattern, new String[][] { { "###host###", host }, { "###webapp###", webapp } });
// 
// 		final File file = new File(fileName);
// 		file.getParentFile().mkdirs();
// 		try {
// 			outWriter = new PrintWriter(new FileOutputStream(file, Boolean.TRUE), Boolean.TRUE);
// 		} catch (final FileNotFoundException e) {
// 			logger.error("Unable to open " + fileName, e);
// 		}
// 
// 		logger.info(String.format("Initialized access log at %s (format: %s)", fileName, patternType));
// 	}
// 
// 	@Override
// 	public void log(final String originalURL, final WinstoneRequest request, final WinstoneResponse response) {
// 		if (outWriter == null) {
// 			return;
// 		}
// 		final String uriLine = request.getMethod() + " " + originalURL + " " + request.getProtocol();
// 		final int status = response.getErrorStatusCode() == null ? response.getStatus() : response.getErrorStatusCode().intValue();
// 		final long size = response.getWinstoneOutputStream().getBytesCommitted();
// 		final String date = dateCache.now();
// 		final String logLine = StringUtils.replace(pattern,
// 				new String[][] { { "###ip###", request.getRemoteHost() }, { "###user###", SimpleAccessLogger.nvl(request.getRemoteUser()) }, { "###time###", "[" + date + "]" }, { "###uriLine###", uriLine }, { "###status###", "" + status },
// 						{ "###size###", "" + size }, { "###referer###", SimpleAccessLogger.nvl(request.getHeader("Referer")) }, { "###userAgent###", SimpleAccessLogger.nvl(request.getHeader("User-Agent")) } });
// 		outWriter.println(logLine);
// 	}
// 
// 	private static String nvl(final String input) {
// 		return input == null ? "-" : input;
// 	}
// 
// 	public void destroy() {
// 		logger.info("Closed access log");
// 		if (outWriter != null) {
// 			outWriter.flush();
// 			outWriter.close();
// 			outWriter = null;
// 		}
// 	}
// 
// }


import net.winstone.accesslog.SimpleAccessLogger;

/**
 * 
 */
package net.winstone.config;


/**
 * SimpleAccessLoggerConfiguration.
 * 
 *  @author <a href="mailto:jguibert@intelligents-ia.com" >Jerome Guibert</a>
 * 
 */
public class SimpleAccessLoggerConfiguration extends AccessLoggerConfiguration {
	/**
	 * serialVersionUID:long
	 */
	private static final long serialVersionUID = 491570258594643467L;
	/**
	 * The log format to use. Supports combined/common/resin/custom.
	 */
	private String loggerFormat;
	/**
	 * The location pattern for the log file.
	 */
	private String loggerFilePattern;

	/**
	 * Build a new instance of SimpleAccessLoggerConfiguration.
	 * 
	 * @param className
	 * @param loggerFormat
	 * @param loggerFilePattern
	 */
	public SimpleAccessLoggerConfiguration(String loggerFormat, String loggerFilePattern) {

// Path: winstone/src/main/java/net/winstone/accesslog/SimpleAccessLogger.java
// public final class SimpleAccessLogger implements AccessLogger {
// 	protected Logger logger = LoggerFactory.getLogger(getClass());
// 
// 	private final DateCache dateCache;
// 	private final String pattern;
// 	private PrintWriter outWriter;
// 
// 	/**
// 	 * 
// 	 * Build a new instance of SimpleAccessLogger.
// 	 * @param host
// 	 * @param webapp
// 	 * @param patternType
// 	 * @param filePattern
// 	 */
// 	SimpleAccessLogger(final String host, final String webapp, final PatternType patternType, final String filePattern) {
// 		super();
// 		dateCache = new DateCache(new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z"));
// 		pattern = patternType.getPattern();
// 		final String fileName = StringUtils.replace(filePattern, new String[][] { { "###host###", host }, { "###webapp###", webapp } });
// 
// 		final File file = new File(fileName);
// 		file.getParentFile().mkdirs();
// 		try {
// 			outWriter = new PrintWriter(new FileOutputStream(file, Boolean.TRUE), Boolean.TRUE);
// 		} catch (final FileNotFoundException e) {
// 			logger.error("Unable to open " + fileName, e);
// 		}
// 
// 		logger.info(String.format("Initialized access log at %s (format: %s)", fileName, patternType));
// 	}
// 
// 	@Override
// 	public void log(final String originalURL, final WinstoneRequest request, final WinstoneResponse response) {
// 		if (outWriter == null) {
// 			return;
// 		}
// 		final String uriLine = request.getMethod() + " " + originalURL + " " + request.getProtocol();
// 		final int status = response.getErrorStatusCode() == null ? response.getStatus() : response.getErrorStatusCode().intValue();
// 		final long size = response.getWinstoneOutputStream().getBytesCommitted();
// 		final String date = dateCache.now();
// 		final String logLine = StringUtils.replace(pattern,
// 				new String[][] { { "###ip###", request.getRemoteHost() }, { "###user###", SimpleAccessLogger.nvl(request.getRemoteUser()) }, { "###time###", "[" + date + "]" }, { "###uriLine###", uriLine }, { "###status###", "" + status },
// 						{ "###size###", "" + size }, { "###referer###", SimpleAccessLogger.nvl(request.getHeader("Referer")) }, { "###userAgent###", SimpleAccessLogger.nvl(request.getHeader("User-Agent")) } });
// 		outWriter.println(logLine);
// 	}
// 
// 	private static String nvl(final String input) {
// 		return input == null ? "-" : input;
// 	}
// 
// 	public void destroy() {
// 		logger.info("Closed access log");
// 		if (outWriter != null) {
// 			outWriter.flush();
// 			outWriter.close();
// 			outWriter = null;
// 		}
// 	}
// 
// }


// Path: winstone/src/main/java/net/winstone/config/SimpleAccessLoggerConfiguration.java
import net.winstone.accesslog.SimpleAccessLogger;

/**
 * 
 */
package net.winstone.config;


/**
 * SimpleAccessLoggerConfiguration.
 * 
 *  @author <a href="mailto:jguibert@intelligents-ia.com" >Jerome Guibert</a>
 * 
 */
public class SimpleAccessLoggerConfiguration extends AccessLoggerConfiguration {
	/**
	 * serialVersionUID:long
	 */
	private static final long serialVersionUID = 491570258594643467L;
	/**
	 * The log format to use. Supports combined/common/resin/custom.
	 */
	private String loggerFormat;
	/**
	 * The location pattern for the log file.
	 */
	private String loggerFilePattern;

	/**
	 * Build a new instance of SimpleAccessLoggerConfiguration.
	 * 
	 * @param className
	 * @param loggerFormat
	 * @param loggerFilePattern
	 */
	public SimpleAccessLoggerConfiguration(String loggerFormat, String loggerFilePattern) {

		super(SimpleAccessLogger.class.getName());
