|
What this is
Other links
The source code
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software
* License version 1.1, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*/
package org.apache.log4j.config;
import java.io.*;
import java.util.*;
import org.apache.log4j.*;
/**
Prints the configuration of the log4j default hierarchy
(which needs to be auto-initialized) as a propoperties file
on a {@link PrintWriter}.
@author Anders Kristensen
*/
public class PropertyPrinter implements PropertyGetter.PropertyCallback {
protected int numAppenders = 0;
protected Hashtable appenderNames = new Hashtable();
protected Hashtable layoutNames = new Hashtable();
protected PrintWriter out;
protected boolean doCapitalize;
public
PropertyPrinter(PrintWriter out) {
this(out, false);
}
public
PropertyPrinter(PrintWriter out, boolean doCapitalize) {
this.out = out;
this.doCapitalize = doCapitalize;
print(out);
out.flush();
}
protected
String genAppName() {
return "A" + numAppenders++;
}
/**
Returns true if the specified appender name is considered to have
been generated, i.e. if it is of the form A[0-9]+.
*/
protected
boolean isGenAppName(String name) {
if (name.length() < 2 || name.charAt(0) != 'A') return false;
for (int i = 0; i < name.length(); i++) {
if (name.charAt(i) < '0' || name.charAt(i) > '9') return false;
}
return true;
}
/**
* Prints the configuration of the default log4j hierarchy as a Java
* properties file on the specified Writer.
*
*
|
Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com