avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/tools/bin log-group-gen.py
Date Sun, 22 Apr 2001 07:30:53 GMT
donaldp     01/04/22 00:30:53

  Added:       tools/bin log-group-gen.py
  Removed:     src/script log-group-gen.py
  Add in script to generate log entries for server.xml
  Submitted By: "Harmeet Bedi" <hbedi@yahoo.com>
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/tools/bin/log-group-gen.py
  Index: log-group-gen.py
  Generates log targets from assembly.xml
  from org.apache.excalibur.io import ExtensionFileFilter
  from java.io import File
  from java.io import FileInputStream
  from org.xml.sax import InputSource;
  from org.apache.xerces.parsers import DOMParser;
  from java.io import PrintStream
  from java.lang import System
  import string
  def gen(confDir="."):
      dir = File(confDir);
      assembly = dir.listFiles(ExtensionFileFilter("assembly.xml"))
      assembly = assembly[0]
      print 'assembly file: ',assembly
      fin = FileInputStream(assembly);
      src = InputSource(fin);
      parser = DOMParser()
      doc = parser.getDocument();
      root = doc.getDocumentElement();
      nl = root.getChildNodes()
      len = nl.getLength()
      for ni in range(len):
          n = nl.item(ni)
          if n.getNodeType()==n.ELEMENT_NODE and n.getNodeName()=='block':
              name = n.getAttribute('name')
              print '<category name="'+name+'" target="'+name+'-target" priority="DEBUG"/>'
              print '<log-target name="'+name+'-target" location="/logs/'+name+'.log"/>'

To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

View raw message