Return-Path: Delivered-To: apmail-jakarta-log4j-dev-archive@apache.org Received: (qmail 3072 invoked from network); 11 Apr 2003 16:24:11 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 11 Apr 2003 16:24:11 -0000 Received: (qmail 11587 invoked by uid 97); 11 Apr 2003 16:26:07 -0000 Delivered-To: qmlist-jakarta-archive-log4j-dev@nagoya.betaversion.org Received: (qmail 11580 invoked from network); 11 Apr 2003 16:26:06 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 11 Apr 2003 16:26:06 -0000 Received: (qmail 99469 invoked by uid 500); 11 Apr 2003 16:22:36 -0000 Mailing-List: contact log4j-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@jakarta.apache.org Received: (qmail 99449 invoked from network); 11 Apr 2003 16:22:35 -0000 Received: from notes.dtint.com (198.252.208.30) by daedalus.apache.org with SMTP; 11 Apr 2003 16:22:35 -0000 To: log4j-dev@jakarta.apache.org Subject: Configurators MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.0 September 26, 2002 Message-ID: From: RBair@dtint.com Date: Fri, 11 Apr 2003 10:22:22 -0600 X-MIMETrack: Serialize by Router on Notes_Server/DTInt(Release 5.0.12 |February 13, 2003) at 04/11/2003 10:22:39 AM, Serialize complete at 04/11/2003 10:22:39 AM Content-Type: multipart/alternative; boundary="=_alternative 005A523D87256D05_=" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=_alternative 005A523D87256D05_= Content-Type: text/plain; charset="US-ASCII" Ceki/Mark, I've a couple of doConfigure methods I wanted to add to the DOM and Property configurators. I have my configuration "files" in memory as strings (retrieved from a database). Neither PropertyConfigurator nor DOMConfigurator have a doConfigure method that I can use where I can pass in a String. The new methods I'm proposing provide an InputStream to PropertyConfigurator (pass the string into a ByteArrayInputSream, pass that into doConfigure), and a Reader for DOMConfigurator (pass the string into a StringReader). For consistency, it may be better to just use the input stream in both instances. I'd have used a reader for both, but Properties objects don't have a convenient way to read Readers. Do I have to include an apache license with this code for it to be submitted? CODE: in DOMConfigurator.java /** Configure log4j by reading in a log4j.dtd compliant XML configuration Reader. */ public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError { doConfigure(new InputSource(reader), repository); } in PropertyConfigurator.java /** Read configuration options from an input stream in. */ public void doConfigure(InputStream in, LoggerRepository hierarchy) { Properties props = new Properties(); LogLog.debug("Reading configuration from stream " + in); try { props.load(in); } catch (java.io.IOException e) { LogLog.error( "Could not read configuration from stream [" + in + "].", e); LogLog.error("Ignoring configuration stream [" + in + "]."); return; } doConfigure(props, hierarchy); } --=_alternative 005A523D87256D05_=--