logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r1345524 [11/17] - in /logging/log4j/branches/log4j12-bz53299: ./ contribs/ contribs/CekiGulcu/ contribs/EirikLygre/ contribs/JamesHouse/ contribs/Jamie Tsao/ contribs/JimMoore/ contribs/KevinSteppe/ contribs/KitchingSimon/ contribs/LeosLit...
Date Sat, 02 Jun 2012 15:36:26 GMT
Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/TextPanelAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/TextPanelAppender.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/TextPanelAppender.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/TextPanelAppender.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.gui;
+
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.io.*;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Hashtable;
+import java.util.ArrayList;
+
+import javax.swing.JPanel;
+
+import org.apache.log4j.*;
+
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.helpers.Loader;
+import org.apache.log4j.helpers.QuietWriter;
+import org.apache.log4j.helpers.TracerPrintWriter;
+import org.apache.log4j.helpers.OptionConverter;
+
+/**
+ *
+ * @author James House
+ */
+public class TextPanelAppender extends AppenderSkeleton {
+
+  TracerPrintWriter tp;
+  StringWriter sw;
+  QuietWriter qw;
+  LogTextPanel logTextPanel;
+  LogPublishingThread logPublisher;
+
+  final String COLOR_OPTION_FATAL = "Color.Fatal";
+  final String COLOR_OPTION_ERROR = "Color.Error";
+  final String COLOR_OPTION_WARN = "Color.Warn";
+  final String COLOR_OPTION_INFO = "Color.Info";
+  final String COLOR_OPTION_DEBUG = "Color.Debug";
+  final String COLOR_OPTION_BACKGROUND = "Color.Background";
+  final String FONT_NAME_OPTION = "Font.Name";
+  final String FONT_SIZE_OPTION = "Font.Size";
+  final String EVENT_BUFFER_SIZE_OPTION = "EventBuffer.Size";
+
+  public TextPanelAppender(Layout layout, String name) {
+    this.layout = layout;
+    this.name = name;
+    this.sw = new StringWriter();
+    this.qw = new QuietWriter(sw, errorHandler);
+    this.tp = new TracerPrintWriter(qw);
+    setLogTextPanel(new LogTextPanel());
+    logPublisher = new LogPublishingThread(logTextPanel, Priority.ERROR, 500);
+    //logPublisher = new LogPublishingThread(logTextPanel, null, 500);
+  }
+
+  public
+  void close() {
+  }
+
+  public void append(LoggingEvent event) {
+
+    String text = this.layout.format(event);
+
+    // Print Stacktrace
+    // Quick Hack maybe there is a better/faster way?
+    if (event.throwable!=null) {
+      event.throwable.printStackTrace(tp);
+      for (int i=0; i< sw.getBuffer().length(); i++) {
+        if (sw.getBuffer().charAt(i)=='\t')
+          sw.getBuffer().replace(i,i+1,"        ");
+      }
+      text += sw.toString();
+      sw.getBuffer().delete(0,sw.getBuffer().length());
+    }
+    else
+      if(!text.endsWith("\n"))
+        text += "\n";
+
+    logPublisher.publishEvent(event.priority, text);
+  }
+
+  public
+  JPanel getLogTextPanel() {
+    return logTextPanel;
+  }
+
+  public
+  String[] getOptionStrings() {
+    return new String[] { COLOR_OPTION_FATAL, COLOR_OPTION_ERROR,
+         COLOR_OPTION_WARN, COLOR_OPTION_INFO, COLOR_OPTION_DEBUG,
+         COLOR_OPTION_BACKGROUND, FONT_NAME_OPTION, FONT_SIZE_OPTION};
+  }
+
+
+  public
+  void setName(String name) {
+    this.name = name;
+  }
+
+  protected
+  void setLogTextPanel(LogTextPanel logTextPanel) {
+    this.logTextPanel = logTextPanel;
+    logTextPanel.setTextBackground(Color.white);
+  }
+
+  public
+  void setOption(String option, String value) {
+    if (option.equalsIgnoreCase(COLOR_OPTION_FATAL))
+      logTextPanel.setTextColor(Priority.FATAL,value);
+    if (option.equalsIgnoreCase(COLOR_OPTION_ERROR))
+      logTextPanel.setTextColor(Priority.ERROR,value);
+    if (option.equalsIgnoreCase(COLOR_OPTION_WARN))
+      logTextPanel.setTextColor(Priority.WARN,value);
+    if (option.equalsIgnoreCase(COLOR_OPTION_INFO))
+      logTextPanel.setTextColor(Priority.INFO,value);
+    if (option.equalsIgnoreCase(COLOR_OPTION_DEBUG))
+      logTextPanel.setTextColor(Priority.DEBUG,value);
+    if (option.equalsIgnoreCase(COLOR_OPTION_BACKGROUND))
+      logTextPanel.setTextBackground(value);
+    if (option.equalsIgnoreCase(FONT_SIZE_OPTION))
+      logTextPanel.setTextFontSize(Integer.parseInt(value));
+    if (option.equalsIgnoreCase(FONT_NAME_OPTION))
+      logTextPanel.setTextFontName(value);
+    if (option.equalsIgnoreCase(EVENT_BUFFER_SIZE_OPTION))
+      logTextPanel.setEventBufferSize(Integer.parseInt(value));
+    return;
+  }
+
+  public
+  boolean requiresLayout() {
+    return true;
+  }
+
+
+
+  class LogPublishingThread extends Thread {
+
+    LogTextPanel logTextPanel;
+    ArrayList evts;
+    Priority triggerPrio;
+    long pubInterval;
+
+    public LogPublishingThread(LogTextPanel logTextPanel, Priority triggerPrio, long pubInterval) {
+      this.logTextPanel = logTextPanel;
+      this.evts = new ArrayList(1000);
+      this.triggerPrio = triggerPrio;
+      this.pubInterval = pubInterval;
+      //this.setPriority(Thread.NORM_PRIORITY - 1);
+      this.start();
+    }
+
+    public void run() {
+      while(true) {
+        synchronized(evts) {
+          try {
+            evts.wait(pubInterval);
+          }
+          catch(InterruptedException e) {}
+
+          logTextPanel.newEvents((EventBufferElement[])evts.toArray(new EventBufferElement[evts.size()]));
+
+          evts.clear();
+        }
+      }
+
+    }
+
+    public void publishEvent(Priority prio, String text) {
+      synchronized(evts) {
+        evts.add(new EventBufferElement(prio, text));
+        if(triggerPrio != null && prio.isGreaterOrEqual(triggerPrio))
+          evts.notify();
+      }
+    }
+  }
+
+} // TextPaneAppender
+
+class EventBufferElement {
+
+  public String text;
+  public Priority prio;
+  public int numLines;
+
+  EventBufferElement(Priority prio, String text) {
+    this.prio = prio;
+    this.text = text;
+    numLines = 1;
+    int pos = pos = text.indexOf('\n', 0);
+    int len = text.length() - 1;
+
+    while( (pos > 0) && (pos < len) )
+      numLines++;
+      pos = text.indexOf('\n', pos + 1);
+  }
+}
+
+

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/TextPanelAppender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/LogTextPanelExample.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/LogTextPanelExample.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/LogTextPanelExample.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/LogTextPanelExample.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.gui.examples;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+import org.apache.log4j.*;
+import org.apache.log4j.gui.TextPanelAppender;
+
+/**
+ * @author James House
+ */
+public class LogTextPanelExample {
+  boolean packFrame = false;
+
+  String catName = "dum.cat.name";
+
+  public LogTextPanelExample() {
+
+    // setup the logging
+    TextPanelAppender tpa = new TextPanelAppender(new PatternLayout("%-5p %d [%t]:  %m%n"), "logTextPanel");
+    tpa.setThreshold(Priority.DEBUG);
+    Category cat = Category.getInstance(catName);
+    cat.addAppender(tpa);
+
+    LogFrame frame = new LogFrame(tpa);
+    frame.validate();
+
+    //Center the frame (window), and show it
+    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+    Dimension frameSize = frame.getSize();
+    if (frameSize.height > screenSize.height) {
+      frameSize.height = screenSize.height;
+    }
+    if (frameSize.width > screenSize.width) {
+      frameSize.width = screenSize.width;
+    }
+    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
+    frame.setVisible(true);
+  }
+
+  /**Main method*/
+  public static void main(String[] args) {
+    try {
+      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+    }
+    catch(Exception e) {
+      e.printStackTrace();
+    }
+    LogTextPanelExample foo = new LogTextPanelExample();
+    new LogTextPanelExampleGenThread(foo.catName);
+  }
+}
+
+class LogFrame extends JFrame {
+
+  public LogFrame(TextPanelAppender tpa) {
+    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+    JPanel contentPane = (JPanel) this.getContentPane();
+    contentPane.setLayout(new BorderLayout());
+    this.setSize(new Dimension(600, 400));
+    this.setTitle("LogTextPanel Example");
+    contentPane.add(tpa.getLogTextPanel(), BorderLayout.CENTER);
+  }
+
+  // exit when window is closed
+  protected void processWindowEvent(WindowEvent e) {
+    super.processWindowEvent(e);
+    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
+      System.exit(0);
+    }
+  }
+}
+
+class LogTextPanelExampleGenThread extends Thread {
+
+  String catName;
+
+  public LogTextPanelExampleGenThread(String catName) {
+    this.catName = catName;
+    this.setPriority(Thread.NORM_PRIORITY - 1);
+    this.start();
+  }
+
+  public void run() {
+    Category cat = Category.getInstance(catName);
+    int cnt = 0;
+    while(true) {
+      cnt++;
+      int randEvt = (int)(Math.random() * 125);
+      if(randEvt < 3)
+        cat.fatal("{" + cnt + "} Something screwed up bad.");
+      else if(randEvt < 10)
+        cat.error("{" + cnt + "} An error occured while trying to delete all of your files.");
+      else if(randEvt < 25)
+        cat.warn("{" + cnt + "} It seems as if your hard disk is getting full.");
+      else if(randEvt < 55)
+        cat.info("{" + cnt + "} It is now time for tea.");
+      else if(randEvt < 65)
+        cat.debug("{" + cnt + "} Something bad is happening on line 565 of com.foo.Crap");
+      else if(randEvt < 75)
+        cat.debug("{" + cnt + "} Input value for xe343dd is not equal to xe39dfd!");
+      else if(randEvt < 85)
+        cat.debug("{" + cnt + "} Successfully reached line 2312 of com.foo.Goo");
+      else if(randEvt < 105)
+        cat.debug("{" + cnt + "} Here is some extra handy debugging information for you.");
+      else if(randEvt < 115)
+        cat.debug("{" + cnt + "} The file you are about to write to is not open.");
+      else if(randEvt < 125)
+        cat.debug("{" + cnt + "} The input value to the method was <null>.");
+
+      try {
+        Thread.sleep(10);
+      }
+      catch(Exception e) {}
+
+    }
+  }
+}
\ No newline at end of file

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/LogTextPanelExample.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/TextPaneAppenderExample.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/TextPaneAppenderExample.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/TextPaneAppenderExample.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/TextPaneAppenderExample.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.gui.examples;
+
+import java.awt.event.*;
+import javax.swing.*;
+import org.apache.log4j.*;
+import org.apache.log4j.gui.*;
+
+/**
+ * @author Sven Reimers
+ */
+public class TextPaneAppenderExample implements ActionListener {
+
+    JFrame mainframe;
+    ButtonGroup priorities;
+    TextPaneAppender tpa;
+    Category gui;
+    Priority prio[];
+    JTabbedPane logview;
+    
+    
+    public TextPaneAppenderExample () {
+	mainframe = new JFrame("Testing the TextPaneAppender...");
+	mainframe.setSize(300,300);
+	logview = new JTabbedPane();
+	createLogger();
+	createMenuBar();
+	mainframe.setVisible(true);
+	mainframe.getContentPane().add(logview);
+    }
+
+    public void createLogger() {
+	tpa = new TextPaneAppender(new PatternLayout("%-5p %d [%t]:  %m%n"),"Debug");
+	logview.addTab("Events ...",new JScrollPane(tpa.getTextPane()));
+	gui = Category.getInstance(this.getClass().getName());
+	gui.addAppender(tpa);
+    }
+    
+    public void createMenuBar() {
+	JMenu file = new JMenu("File");
+	JMenuItem exit = new JMenuItem("Exit");
+	exit.addActionListener(new ActionListener() {
+		public void actionPerformed(ActionEvent ae) {
+		    System.exit(0);
+		}
+	    });
+	file.add(exit);
+	JMenuBar mb = new JMenuBar();
+	mb.add(file);
+	
+	JMenu logevent = new JMenu("LoggingEvents");
+	JMenu selectprio = new JMenu("Priority");
+	
+	prio = Priority.getAllPossiblePriorities();
+	JRadioButtonMenuItem priority[]= new JRadioButtonMenuItem[prio.length];
+	priorities = new ButtonGroup();
+	
+	for (int i=0; i<prio.length;i++) {
+	    if (i==0)
+		priority[i] = new JRadioButtonMenuItem(prio[i].toString(),true);
+	    else
+		priority[i] = new JRadioButtonMenuItem(prio[i].toString());
+	    priority[i].setActionCommand(prio[i].toString());
+	    selectprio.add(priority[i]);
+	    priorities.add(priority[i]);
+
+	}
+	
+	logevent.add(selectprio);
+	
+	JMenuItem lognow = new JMenuItem("LogIt!");
+	lognow.addActionListener(this);
+	logevent.add(lognow);
+	
+	mb.add(logevent);
+	
+	mainframe.setJMenuBar(mb);
+	
+    }
+    
+    public void actionPerformed(ActionEvent ae){
+	String logtext = JOptionPane.showInputDialog("Text to log");
+	if (logtext == null) logtext="NO Input";
+	int i=0;
+	String name = priorities.getSelection().getActionCommand();
+	while (!prio[i].toString().equals(name))
+	    i=i+1;
+	gui.log(prio[i],logtext);
+    }
+
+    static public void main(String args[]) {
+	TextPaneAppenderExample tpex = new TextPaneAppenderExample();
+    }
+    
+}

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/gui/examples/TextPaneAppenderExample.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/helpers/SingleLineTracerPrintWriter.java (from r1345516, logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/SingleLineTracerPrintWriter.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/helpers/SingleLineTracerPrintWriter.java?p2=logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/helpers/SingleLineTracerPrintWriter.java&p1=logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/SingleLineTracerPrintWriter.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/helpers/SingleLineTracerPrintWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/helpers/SingleLineTracerPrintWriter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/DatagramStringAppender.java (from r1345516, logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/DatagramStringAppender.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/DatagramStringAppender.java?p2=logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/DatagramStringAppender.java&p1=logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/DatagramStringAppender.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/DatagramStringAppender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/DatagramStringAppender.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/PluggableHTTPServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/PluggableHTTPServer.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/PluggableHTTPServer.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/PluggableHTTPServer.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.net;
+
+import java.net.*;
+import java.io.*;
+import java.util.*;
+import org.apache.log4j.*;
+
+/**
+ * This class implements a HTTP-server frame. All HTTP-requests are handled by HTTPRequestHandler
+ * classes which implement the <code>HTTPRequestHandler</code> interface. Every RequestHandler has
+ * to be registered in the PluggableHTTPServer with the <code>addRequestHandler</code> method.
+ * A new thread is created for each connection to handle the request. If all reply data are sent
+ * to the client the connection is closed and the thread ends.
+ * An example how to use the PluggableHTTPServer class can be found in the <code>main</code> method
+ * at the end of the source file.
+ *
+ * @author <a HREF="mailto:V.Mentzner@psi-bt.de">Volker Mentzner</a>
+ */
+public class PluggableHTTPServer implements Runnable {
+
+  public static final int DEFAULT_PORT = 80;
+  static Category cat = Category.getInstance("PluggableHTTPServer");
+  private int port;
+  private Vector handler;
+  private ServerSocket server;
+
+  /**
+   * Creates a new server object on the given TCP port.
+   * If the port is occupied by another process a IOException (java.net.BindException) is thrown.
+   *
+   * @param port - TCP port number to listen on for requests
+   */
+  public PluggableHTTPServer(int port) throws IOException {
+    this.port = port;
+    this.handler = new Vector();
+    cat.setPriority(Priority.ERROR);
+    server = new ServerSocket(this.port);
+  }
+
+  /**
+   * Creates a new server object on the default TCP port 80
+   * If the port is occupied by another process a IOException (java.net.BindException) is thrown.
+   */
+  public PluggableHTTPServer() throws IOException {
+    this(DEFAULT_PORT);
+  }
+
+  /**
+   * Registers the given HTTPRequestHandler
+   *
+   * @param h - the HTTPRequestHandler to register
+   */
+  public void addRequestHandler(HTTPRequestHandler h) {
+    handler.add(h);
+  }
+
+  /**
+   * Unregisters the given HTTPRequestHandler
+   *
+   * @param h - the HTTPRequestHandler to unregister
+   */
+  public void removeRequestHandler(HTTPRequestHandler h) {
+    handler.remove(h);
+  }
+
+  /**
+   * Sends the HTTP message 404 - File Not Found
+   * see RFC2616 for details
+   *
+   * @param out - Out stream for sending data to client browser
+   */
+  public static void replyNotFound(Writer out) {
+    try {
+      out.write("HTTP/1.0 404 Not Found\r\n");
+      out.write("<HTML><HEAD><TITLE>Not Found</TITLE></HEAD>\r\n");
+      out.write("<BODY><H1>Not Found</H1>\r\n");
+      out.write("</BODY></HTML>\r\n");
+      out.flush();
+    }  // end try
+    catch (IOException e) {
+    }
+  }
+
+  /**
+   * Sends the HTTP message 405 - Method Not Allowed
+   * see RFC2616 for details
+   *
+   * @param out - Out stream for sending data to client browser
+   */
+  public static void replyMethodNotAllowed(Writer out) {
+    try {
+      out.write("HTTP/1.1 405 Method Not Allowed\r\n");
+      out.write("Allow: GET, PUT\r\n");
+      out.write("<HTML><HEAD><TITLE>Method Not Allowed</TITLE></HEAD>\r\n");
+      out.write("<BODY><H1>Method Not Allowed</H1>\r\n");
+      out.write("</BODY></HTML>\r\n");
+      out.flush();
+    }  // end try
+    catch (IOException e) {
+    }
+  }
+
+  /**
+   * Creates the ReplyHTML data for the root page
+   *
+   * @param index - index of the RootRequestHandler
+   */
+  public void autoCreateRootPage(int index) {
+    if (handler.get(index) instanceof RootRequestHandler) {
+      RootRequestHandler r = (RootRequestHandler)handler.get(index);
+      String html = "<HTML><HEAD><TITLE>"+r.getTitle()+"</TITLE></HEAD>\r\n";
+      html = html + "<BODY><H1>"+r.getDescription()+"</H1>\r\n";
+      for (int i = 0; i < handler.size(); i++) {
+        html = html + "<a href=\"" + ((HTTPRequestHandler)handler.get(i)).getHandledPath();
+        html = html + "\">" + ((HTTPRequestHandler)handler.get(i)).getDescription() + "</a><br>";
+      }
+      html = html + "</BODY></HTML>\r\n";
+      r.setReplyHTML(html);
+    }
+  }
+
+  /**
+   * Main loop of the PluggableHTTPServer
+   */
+  public void run() {
+    while (true) {
+      try {
+        Socket s = server.accept();
+        Thread t = new ServerThread(s);
+        t.start();
+      }
+      catch (IOException e) {
+      }
+    }
+  }
+
+  /**
+   * This class handles the incomming connection for one request.
+   */
+  class ServerThread extends Thread {
+
+    private Socket connection;
+
+    ServerThread(Socket s) {
+      this.connection = s;
+    }
+
+    /**
+     * Serves the HTTP request.
+     */
+    public void run() {
+      try {
+        Writer out = new BufferedWriter(
+                      new OutputStreamWriter(
+                       connection.getOutputStream(), "ASCII"
+                      )
+                     );
+        Reader in = new InputStreamReader(
+                     new BufferedInputStream(
+                      connection.getInputStream()
+                     )
+                    );
+
+        // read the first line only; that's all we need
+        StringBuffer req = new StringBuffer(80);
+        while (true) {
+          int c = in.read();
+          if (c == '\r' || c == '\n' || c == -1) break;
+          req.append((char) c);
+        }
+        String get = req.toString();
+        cat.debug(get);
+        StringTokenizer st = new StringTokenizer(get);
+        String method = st.nextToken();
+        String request = st.nextToken();
+        String version = st.nextToken();
+
+        if (method.equalsIgnoreCase("GET")) {
+          boolean served = false;
+          for (int i = 0; i < handler.size(); i++) {
+            if (handler.get(i) instanceof HTTPRequestHandler) {
+              if (((HTTPRequestHandler)handler.get(i)).handleRequest(request, out)) {
+                served = true;
+                break;
+              }
+            }
+          }
+          if (!served)
+            PluggableHTTPServer.replyNotFound(out);
+        }
+        else {
+          PluggableHTTPServer.replyMethodNotAllowed(out);
+        }
+      } // end try
+      catch (IOException e) {
+      }
+      finally {
+        try {
+          if (connection != null) connection.close();
+        }
+        catch (IOException e) {}
+      }
+    }  // end run
+  }  // end class ServerThread
+
+  /**
+   * Demo how to use the PluggableHTTPServer.
+   */
+  public static void main(String[] args) {
+
+    int thePort;
+
+    // create some logging stuff
+    BasicConfigurator.configure();
+    Category cat1 = Category.getInstance("cat1");
+    cat1.addAppender(new org.apache.log4j.ConsoleAppender(new PatternLayout("%m%n")));
+    Category cat2 = Category.getInstance("cat2");
+    cat2.setPriority(Priority.INFO);
+    cat2.addAppender(new org.apache.log4j.ConsoleAppender(new PatternLayout("%c - %m%n")));
+
+    // set TCP port number
+    try {
+      thePort = Integer.parseInt(args[1]);
+    }
+    catch (Exception e) {
+      thePort = PluggableHTTPServer.DEFAULT_PORT;
+    }
+
+    PluggableHTTPServer server = null;
+    while (server == null) {
+      try {
+        server = new PluggableHTTPServer(thePort);
+        server.addRequestHandler(new RootRequestHandler());
+        server.addRequestHandler(new Log4jRequestHandler());
+        server.addRequestHandler(new UserDialogRequestHandler());
+        server.autoCreateRootPage(0);
+        Thread t = new Thread(server);
+        t.start();
+      } catch (IOException e) {
+        server = null;
+        thePort++;
+      }
+    }
+
+  }  // end main
+}

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/PluggableHTTPServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketNode2.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketNode2.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketNode2.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketNode2.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.net;
+
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+
+import org.apache.log4j.Category;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.Priority;
+import org.apache.log4j.NDC;
+
+// Contributors:  Moses Hohman <mmhohman@rainbow.uchicago.edu>
+
+/**
+   Read {@link LoggingEvent} objects sent from a remote client using
+   Sockets (TCP). These logging events are logged according to local
+   policy, as if they were generated locally.
+
+   <p>For example, the socket node might decide to log events to a
+   local file and also resent them to a second socket node.
+
+	@author  Ceki G&uuml;lc&uuml;
+
+	@since 0.8.4
+*/
+public class SocketNode2 implements Runnable {
+
+  Socket socket;
+  ObjectInputStream ois;
+
+  static Category cat = Category.getInstance(SocketNode2.class.getName());
+
+  public
+  SocketNode2(Socket socket) {
+	this.socket = socket;
+	try {
+	  ois = new ObjectInputStream(socket.getInputStream());
+	}
+	catch(Exception e) {
+	  cat.error("Could not open ObjectInputStream to "+socket, e);
+	}
+  }
+
+  //public
+  //void finalize() {
+  //System.err.println("-------------------------Finalize called");
+  // System.err.flush();
+  //}
+
+  public void run() {
+	LoggingEvent event;
+	Category remoteCategory;
+	String strClientName;
+
+	// Get the client name.
+	InetAddress addr = socket.getInetAddress();
+	strClientName = addr.getHostName();
+	if(strClientName == null || strClientName.length() == 0)
+	{
+		strClientName = addr.getHostAddress();
+	}
+
+	try {
+	  while(true) {
+	event = (LoggingEvent) ois.readObject();
+
+	if(event.ndc != null)
+	{
+		event.ndc = strClientName + ":" + event.ndc;
+	}
+	else
+	{
+		event.ndc = strClientName;
+	}
+
+	remoteCategory = Category.getInstance(event.categoryName);
+	remoteCategory.callAppenders(event);
+	  }
+	}
+	catch(java.io.EOFException e) {
+	  cat.info("Caught java.io.EOFException will close conneciton.", e);
+	}
+	catch(java.net.SocketException e) {
+	  cat.info("Caught java.net.SocketException, will close conneciton.", e);
+	}
+	catch(Exception e) {
+	  cat.error("Unexpected exception. Closing conneciton.", e);
+	}
+
+	try {
+	  ois.close();
+	}
+	catch(Exception e) {
+	  cat.info("Could not close connection.", e);
+	}
+  }
+}

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketNode2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketServer2.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketServer2.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketServer2.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketServer2.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.log4j.net;
+
+import java.net.Socket;
+import java.net.ServerSocket;
+import java.io.IOException;
+
+import org.apache.log4j.Category;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.NDC;
+
+/**
+   A simple {@link SocketNode} based server.
+
+   <pre>
+	 <b>Usage:</b> java org.apache.log4j.net.SocketServer port configFile
+
+	 where <em>port</em> is a part number where the server listens and
+	 <em>configFile</em> is a configuration file fed to the {@link
+	 PropertyConfigurator}.
+   </pre>
+
+
+
+
+
+	@author  Ceki G&uuml;lc&uuml;
+
+	@since 0.8.4 */
+
+public class SocketServer2  {
+
+  static Category cat = Category.getInstance(SocketServer2.class.getName());
+
+  static int port;
+
+  public
+  static
+  void main(String argv[]) {
+	if(argv.length == 2)
+	  init(argv[0], argv[1]);
+	else
+	  usage("Wrong number of arguments.");
+
+	try {
+	  cat.info("Listening on port " + port);
+	  ServerSocket serverSocket = new ServerSocket(port);
+	  while(true) {
+	cat.info("Waiting to accept a new client.");
+	Socket socket = serverSocket.accept();
+	cat.info("Connected to client at " + socket.getInetAddress());
+	cat.info("Starting new socket node.");
+	new Thread(new SocketNode2(socket)).start();
+	  }
+	}
+	catch(Exception e) {
+	  e.printStackTrace();
+	}
+  }
+
+
+  static
+  void  usage(String msg) {
+	System.err.println(msg);
+	System.err.println(
+	  "Usage: java " + SocketServer2.class.getName() + " port configFile");
+	System.exit(1);
+  }
+
+  static
+  void init(String portStr, String configFile) {
+	try {
+	  port   = Integer.parseInt(portStr);
+	}
+	catch(java.lang.NumberFormatException e) {
+	  e.printStackTrace();
+	  usage("Could not interpret port number ["+ portStr +"].");
+	}
+	PropertyConfigurator.configure(configFile);
+	NDC.push("Server");
+  }
+}

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/SocketServer2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/UserDialogRequestHandler.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/UserDialogRequestHandler.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/UserDialogRequestHandler.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/UserDialogRequestHandler.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Title:        PSI Java Framework: UserDialogRequestHandler<p>
+ * Copyright:    PSI-BT AG<p>
+ * History:
+ *   Date        Author        What's new
+ *   16.04.2001  VMentzner     Created
+ */
+
+package org.apache.log4j.net;
+
+import java.awt.Component;
+import java.io.Writer;
+import java.net.URL;
+
+/**
+ * This class implements a RequestHandler for the path "/userdialog/" in the PluggableHTTPServer.
+ * A simple input form is presented in the browser where you can enter a message. This message will be sent
+ * to the PluggableHTTPServer and shown in a JOptionPane MessageDialog.
+ *
+ * @author <a HREF="mailto:V.Mentzner@psi-bt.de">Volker Mentzner</a>
+ */
+public class UserDialogRequestHandler extends RootRequestHandler {
+
+  private Component parentComponent;
+
+ /**
+   * Creates a new UserDialogRequestHandler object
+   */
+  public UserDialogRequestHandler() {
+    this(null);
+  }
+
+ /**
+   * Creates a new UserDialogRequestHandler object with a parentComponent reference
+   */
+  public UserDialogRequestHandler(Component parentComponent) {
+    this.setTitle("user dialog");
+    this.setDescription("show user dialog");
+    this.setHandledPath("/userdialog/");
+    this.parentComponent = parentComponent;
+  }
+
+ /**
+   * Handles the given request and writes the reply to the given out-stream.
+   *
+   * @param request - client browser request
+   * @param out - Out stream for sending data to client browser
+   * @return if the request was handled by this handler : true, else : false
+   */
+  public boolean handleRequest(String request, Writer out) {
+    String path = "";
+    String query = null;
+    try {
+      URL url = new URL("http://localhost"+request);
+      path = url.getPath();
+      query = url.getQuery();
+      if (path.startsWith(this.getHandledPath()) == false) {
+        return false;
+      }
+
+      out.write("HTTP/1.0 200 OK\r\n");
+      out.write("Content-type: text/html\r\n\r\n");
+      out.write("<HTML><HEAD><TITLE>" + this.getTitle() + "</TITLE></HEAD>\r\n");
+      out.write("<BODY><H1>" + this.getDescription() + "</H1>\r\n");
+      if ((query != null) && (query.length() >= 0)) {
+        int idx = query.indexOf("=");
+        String message = query.substring(idx+1, query.length());
+        // replace '+' by space
+        message = message.replace('+', ' ');
+        // replace hex strings starting with '%' by their values
+        idx = message.indexOf("%");
+        while (idx >= 0) {
+          String sl = message.substring(0, idx);
+          String sm = message.substring(idx+1, idx+3);
+          String sr = message.substring(idx+3, message.length());
+          try {
+            int i = Integer.parseInt(sm, 16);
+            sm = String.valueOf((char)i);
+          }
+          catch (Exception ex) {
+            sm = "";
+          }
+          message = sl + sm + sr;
+          idx = message.indexOf("%");
+        }
+        // show message in a new thread
+        if ((message != null) && (message.length() > 0)) {
+          Thread t = new Thread(new DialogThread(parentComponent, message));
+          t.start();
+        }
+      }
+      out.write("<form name=\"Formular\" ACTION=\""+this.getHandledPath()+"+\" METHOD=\"PUT\">");
+      out.write("<table>\r\n");
+      out.write(" <tr><td>Send message to user</td></tr>\r\n");
+      out.write(" <tr><td><textarea name=\"message\" rows=10 cols=50></textarea></td></tr>\r\n");
+      out.write("</table>\r\n");
+      out.write("<input type=submit value=\"Submit\">");
+      out.write("</form>");
+      out.write("</BODY></HTML>\r\n");
+      out.flush();
+      return true;
+    } catch (Exception ex) {
+      return false;
+    }
+  }
+
+ /**
+   * Internal class to start the user dialog in a new thread. This makes the RequestHandler return
+   * immediatly
+   */
+  class DialogThread implements Runnable {
+    private Component parentComponent;
+    private String message;
+
+    public DialogThread(Component parentComponent, String message) {
+      this.parentComponent = parentComponent;
+      this.message = message;
+    }
+
+    public void run() {
+      JOptionPane.showMessageDialog(parentComponent, message);
+    }
+  }
+}
\ No newline at end of file

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/net/UserDialogRequestHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/varia/test/JDBCTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/varia/test/JDBCTest.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/varia/test/JDBCTest.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/varia/test/JDBCTest.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.varia.test;
+
+import org.apache.log4j.*;
+import org.apache.log4j.net.JDBCAppender;
+
+/**
+ * @author Kevin Sceppe
+ */
+public class JDBCTest
+{
+    public static void main (String argv[])
+    {
+        try {
+      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            System.out.println(e.toString());
+        }
+
+
+     Category rootLog = Category.getRoot();
+        Layout layout = new PatternLayout("%p [%t] %c - %m%n");
+        JDBCAppender appender = new JDBCAppender();
+        appender.setLayout(layout);
+        appender.setOption(org.apache.log4j.net.URL_OPTION, "jdbc:odbc:someDB");
+
+
+        appender.setOption(org.apache.log4j.net.USER_OPTION, "auser");
+        appender.setOption(org.apache.log4j.net.PASSWORD_OPTION, "thepassword");
+
+
+
+        rootLog.addAppender(appender);
+
+
+        try {
+            Category log = Category.getInstance("main");
+            log.debug("Debug 1");
+            Thread.sleep(500);
+            log.info("info 1");
+            Thread.sleep(500);
+            log.warn("warn 1");
+            Thread.sleep(500);
+            log.error("error 1");
+            Thread.sleep(500);
+            log.fatal("fatal 1");
+            Thread.sleep(500);
+
+
+            appender.setOption(org.apache.log4j.net.BUFFER_OPTION, "5");
+            log.debug("Debug 2");
+            Thread.sleep(500);
+            log.info("info 2");
+            Thread.sleep(500);
+            log.warn("warn 2");
+            Thread.sleep(500);
+            log.error("error 2");
+            Thread.sleep(500);
+            log.fatal("fatal 2");
+            Thread.sleep(500);
+
+
+            appender.setOption(org.apache.log4j.net.BUFFER_OPTION, "2");
+            appender.setThreshold(Priority.WARN);
+            log.debug("Debug 3");
+            Thread.sleep(500);
+            log.info("info 3");
+            Thread.sleep(500);
+            log.warn("warn 3");
+            Thread.sleep(500);
+            log.error("error 3");
+            Thread.sleep(500);
+            log.fatal("fatal 3");
+        }
+        catch (InterruptedException e)
+        {
+            System.out.println("Interrupted");
+        }
+    }
+}

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/varia/test/JDBCTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/xml/Transform.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/xml/Transform.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/xml/Transform.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/xml/Transform.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.xml;
+
+import org.apache.log4j.Category;
+import org.apache.log4j.Layout;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.helpers.OptionConverter;
+import org.apache.log4j.helpers.DateLayout;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+import org.xml.sax.SAXException;
+import org.apache.xerces.parsers.SAXParser;
+
+import org.apache.trax.Processor;
+import org.apache.trax.TemplatesBuilder;
+import org.apache.trax.Templates;
+import org.apache.trax.Transformer;
+import org.apache.trax.Result;
+import org.apache.trax.ProcessorException; 
+import org.apache.trax.ProcessorFactoryException;
+import org.apache.trax.TransformException; 
+
+
+import org.apache.serialize.SerializerFactory;
+import org.apache.serialize.Serializer;
+import org.apache.serialize.OutputFormat;
+import org.xml.sax.helpers.AttributesImpl;
+
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author CekiGulcu
+ */
+public class Transform {
+
+  public static void main(String[] args) throws Exception {
+    PropertyConfigurator.disableAll();
+    PropertyConfigurator.configure("x.lcf");
+
+    // I. Instantiate  a stylesheet processor.
+    Processor processor = Processor.newInstance("xslt");
+
+    // II. Process the stylesheet. producing a Templates object.
+
+    // Get the XMLReader.
+    XMLReader reader = XMLReaderFactory.createXMLReader();
+
+    // Set the ContentHandler.
+    TemplatesBuilder templatesBuilder = processor.getTemplatesBuilder();
+    reader.setContentHandler(templatesBuilder);
+
+    // Set the ContentHandler to also function as a LexicalHandler, which
+    // includes "lexical" (e.g., comments and CDATA) events. The Xalan
+    // TemplatesBuilder -- org.apache.xalan.processor.StylesheetHandler -- is
+    // also a LexicalHandler).
+    if(templatesBuilder instanceof LexicalHandler) {
+       reader.setProperty("http://xml.org/sax/properties/lexical-handler", 
+                           templatesBuilder);
+    }
+
+    // Parse the stylesheet.                       
+    reader.parse(args[0]);
+
+    //Get the Templates object from the ContentHandler.
+    Templates templates = templatesBuilder.getTemplates();
+
+    // III. Use the Templates object to instantiate a Transformer.
+    Transformer transformer = templates.newTransformer();
+
+    // IV. Perform the transformation.
+
+    // Set up the ContentHandler for the output.
+	FileOutputStream fos = new FileOutputStream(args[2]);
+    Result result = new Result(fos);
+    Serializer serializer = SerializerFactory.getSerializer("xml");
+    serializer.setOutputStream(fos);
+
+    transformer.setContentHandler(serializer.asContentHandler());
+
+    // Set up the ContentHandler for the input.
+    org.xml.sax.ContentHandler chandler = transformer.getInputContentHandler();
+    DC dc = new DC(chandler);
+    reader.setContentHandler(dc);
+    if(chandler instanceof LexicalHandler) {
+       reader.setProperty("http://xml.org/sax/properties/lexical-handler", 
+			  chandler);
+    } else {
+       reader.setProperty("http://xml.org/sax/properties/lexical-handler", 
+			  null);
+    }
+
+    // Parse the XML input document. The input ContentHandler and
+    // output ContentHandler work in separate threads to optimize
+    // performance.
+    reader.parse(args[1]);
+  }	
+}
+
+ class DC implements ContentHandler {
+
+   static Category cat = Category.getInstance("DC");
+
+   ContentHandler  chandler;
+
+   DC(ContentHandler chandler) {
+     this.chandler = chandler;
+   }
+
+
+  public 
+  void characters(char[] ch, int start, int length) 
+                            throws org.xml.sax.SAXException {
+    cat.debug("characters: ["+new String(ch, start, length)+ "] called");
+    chandler.characters(ch, start, length);
+
+  }
+
+  public 
+  void endDocument() throws org.xml.sax.SAXException {
+    cat.debug("endDocument called.");
+    chandler.endDocument();
+
+  }
+
+  public 
+  void endElement(String namespaceURI, String localName, String qName)
+                                           throws org.xml.sax.SAXException {
+    cat.debug("endElement("+namespaceURI+", "+localName+", "+qName+") called");
+    chandler.endElement(namespaceURI, localName, qName);
+  }
+   
+   public
+   void endPrefixMapping(String prefix) throws org.xml.sax.SAXException {
+     cat.debug("endPrefixMapping("+prefix+") called");
+     chandler.endPrefixMapping(prefix);
+   }
+
+  public 
+  void ignorableWhitespace(char[] ch, int start, int length) 
+                                     throws org.xml.sax.SAXException {
+    cat.debug("ignorableWhitespace called");
+    chandler.ignorableWhitespace(ch, start, length);
+  }
+  
+  public 
+  void processingInstruction(java.lang.String target, java.lang.String data) 
+                                              throws org.xml.sax.SAXException {
+    cat.debug("processingInstruction called");
+    chandler.processingInstruction(target, data);
+  }
+
+  public 
+  void setDocumentLocator(Locator locator)  {
+    cat.debug("setDocumentLocator called");
+    chandler.setDocumentLocator(locator);
+  }
+
+   public
+   void skippedEntity(String name) throws org.xml.sax.SAXException {
+     cat.debug("skippedEntity("+name+")  called");
+     chandler.skippedEntity(name);     
+   }
+  
+  public 
+  void startDocument() throws org.xml.sax.SAXException {
+    cat.debug("startDocument called");
+    chandler.startDocument();
+  }
+  
+  public 
+  void startElement(String namespaceURI, String localName, String qName,
+		    Attributes atts) throws org.xml.sax.SAXException {
+    cat.debug("startElement("+namespaceURI+", "+localName+", "+qName+")called");
+
+    if("log4j:event".equals(qName)) {
+      cat.debug("-------------");      
+      if(atts instanceof org.xml.sax.helpers.AttributesImpl) {
+	AttributesImpl ai = (AttributesImpl) atts;
+	int i = atts.getIndex("timestamp");
+	ai.setValue(i, "hello");
+      }
+      String ts = atts.getValue("timestamp");
+      cat.debug("New timestamp is " + ts);
+    }
+    chandler.startElement(namespaceURI, localName, qName, atts);
+  }
+
+   public
+   void startPrefixMapping(String prefix, String uri) 
+                                          throws org.xml.sax.SAXException {
+     cat.debug("startPrefixMapping("+prefix+", "+uri+") called");     
+     chandler.startPrefixMapping(prefix, uri);
+   }
+           
+   
+}
+

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/stale/org/apache/log4j/xml/Transform.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/logconfig.xml (from r1345516, logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/logconfig.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/logconfig.xml?p2=logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/logconfig.xml&p1=logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/logconfig.xml&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/logconfig.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/logconfig.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/udpserver.pl (from r1345516, logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/udpserver.pl)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/udpserver.pl?p2=logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/udpserver.pl&p1=logging/log4j/branches/log4j12-bz53299/contribs/KitchingSimon/udpserver.pl&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/udpserver.pl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/contribs/src/test/resources/org/apache/log4j/contribs/KitchingSimon/udpserver.pl
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingDefaultConfigurator/InitUsingDefaultConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/InitUsingLog4JProperties.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingLog4JProperties/InitUsingLog4JProperties.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/InitUsingLog4JProperties.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/InitUsingLog4JProperties.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingLog4JProperties/InitUsingLog4JProperties.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/InitUsingLog4JProperties.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/InitUsingLog4JProperties.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/log4j.properties (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingLog4JProperties/log4j.properties)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/log4j.properties?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/log4j.properties&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingLog4JProperties/log4j.properties&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingLog4JProperties/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/InitUsingMultipleAppenders.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/example.properties (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingMultipleAppenders/example.properties)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/example.properties?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/example.properties&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingMultipleAppenders/example.properties&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/example.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingMultipleAppenders/example.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/InitUsingPropertiesFile.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingPropertiesFile/InitUsingPropertiesFile.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/InitUsingPropertiesFile.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/InitUsingPropertiesFile.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingPropertiesFile/InitUsingPropertiesFile.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/InitUsingPropertiesFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/InitUsingPropertiesFile.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/example.properties (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingPropertiesFile/example.properties)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/example.properties?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/example.properties&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingPropertiesFile/example.properties&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/example.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingPropertiesFile/example.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/InitUsingXMLPropertiesFile.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/example.xml (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingXMLPropertiesFile/example.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/example.xml?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/example.xml&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/InitUsingXMLPropertiesFile/example.xml&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/example.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/InitUsingXMLPropertiesFile/example.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/CustomizedLogLevels.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingLogMonitorAdapter/CustomizedLogLevels.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/CustomizedLogLevels.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/CustomizedLogLevels.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingLogMonitorAdapter/CustomizedLogLevels.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/CustomizedLogLevels.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/CustomizedLogLevels.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingLogMonitorAdapter/UsingLogMonitorAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/UsingSocketAppenders.java (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/UsingSocketAppenders.java)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/UsingSocketAppenders.java?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/UsingSocketAppenders.java&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/UsingSocketAppenders.java&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/UsingSocketAppenders.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/UsingSocketAppenders.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketclient.properties (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/socketclient.properties)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketclient.properties?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketclient.properties&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/socketclient.properties&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketclient.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketclient.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketserver.properties (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/socketserver.properties)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketserver.properties?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketserver.properties&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/UsingSocketAppenders/socketserver.properties&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketserver.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/UsingSocketAppenders/socketserver.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/index.html (from r1345516, logging/log4j/branches/log4j12-bz53299/examples/lf5/index.html)
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/index.html?p2=logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/index.html&p1=logging/log4j/branches/log4j12-bz53299/examples/lf5/index.html&r1=1345516&r2=1345524&rev=1345524&view=diff
==============================================================================
    (empty)

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/examples/index.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/pom.xml?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/pom.xml (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/pom.xml Sat Jun  2 15:35:46 2012
@@ -0,0 +1,38 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+      <groupId>org.apache.log4j</groupId>
+      <artifactId>log4j-modules</artifactId>
+      <version>1.4.0-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.log4j</groupId>
+  <artifactId>log4j-lf5</artifactId>
+  <name>Apache Log4j-LF5</name>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/AppenderFinalizer.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/AppenderFinalizer.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/AppenderFinalizer.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/AppenderFinalizer.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.lf5;
+
+import org.apache.log4j.lf5.viewer.LogBrokerMonitor;
+
+/**
+ * <code>AppenderFinalizer</code> has a single method that will finalize
+ * resources associated with a <code>LogBrokerMonitor</code> in the event
+ * that the <code>LF5Appender</code> class is destroyed, and the class loader
+ * is garbage collected.
+ *
+ * @author Brent Sprecher
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class AppenderFinalizer {
+  //--------------------------------------------------------------------------
+  // Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Protected Variables:
+  //--------------------------------------------------------------------------
+
+  protected LogBrokerMonitor _defaultMonitor = null;
+
+  //--------------------------------------------------------------------------
+  // Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Constructors:
+  //--------------------------------------------------------------------------
+
+  public AppenderFinalizer(LogBrokerMonitor defaultMonitor) {
+    _defaultMonitor = defaultMonitor;
+  }
+  //--------------------------------------------------------------------------
+  // Public Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Protected Methods:
+  //--------------------------------------------------------------------------
+
+  /**
+   * @throws java.lang.Throwable
+   */
+  protected void finalize() throws Throwable {
+    System.out.println("Disposing of the default LogBrokerMonitor instance");
+    _defaultMonitor.dispose();
+  }
+
+  //--------------------------------------------------------------------------
+  // Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
\ No newline at end of file

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/AppenderFinalizer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java?rev=1345524&view=auto
==============================================================================
--- logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java (added)
+++ logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java Sat Jun  2 15:35:46 2012
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.lf5;
+
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.spi.Configurator;
+import org.apache.log4j.spi.LoggerRepository;
+
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * The <code>DefaultLF5Configurator</code> provides a default
+ * configuration for the <code>LF5Appender</code>.
+ *
+ * Note: The preferred method for configuring a <code>LF5Appender</code>
+ * is to use the <code>LF5Manager</code> class. This class ensures
+ * that configuration does not occur multiple times, and improves system
+ * performance. Reconfiguring the monitor multiple times can result in
+ * unexpected behavior.
+ *
+ * @author Brent Sprecher
+ */
+
+// Contributed by ThoughtWorks Inc.
+
+public class DefaultLF5Configurator implements Configurator {
+  //--------------------------------------------------------------------------
+  // Constants:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Protected Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Private Variables:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Constructors:
+  //--------------------------------------------------------------------------
+  /**
+   * This class should never be instantiated! It implements the <code>
+   * Configurator</code>
+   * interface, but does not provide the same functionality as full
+   * configurator class.
+   */
+  private DefaultLF5Configurator() {
+
+  }
+
+  //--------------------------------------------------------------------------
+  // Public Methods:
+  //--------------------------------------------------------------------------
+  /**
+   * This method configures the <code>LF5Appender</code> using a
+   * default configuration file. The default configuration file is
+   * <bold>defaultconfig.properties</bold>.
+   * @throws java.io.IOException
+   */
+  public static void configure() throws IOException {
+    String resource =
+        "/org/apache/log4j/lf5/config/defaultconfig.properties";
+    URL configFileResource =
+        DefaultLF5Configurator.class.getResource(resource);
+
+    if (configFileResource != null) {
+      PropertyConfigurator.configure(configFileResource);
+    } else {
+      throw new IOException("Error: Unable to open the resource" +
+          resource);
+    }
+
+  }
+
+  /**
+   * This is a dummy method that will throw an
+   * <code>IllegalStateException</code> if used.
+   */
+  public void doConfigure(URL configURL, LoggerRepository repository) {
+    throw new IllegalStateException("This class should NOT be" +
+        " instantiated!");
+  }
+
+  //--------------------------------------------------------------------------
+  // Protected Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Private Methods:
+  //--------------------------------------------------------------------------
+
+  //--------------------------------------------------------------------------
+  // Nested Top-Level Classes or Interfaces:
+  //--------------------------------------------------------------------------
+
+}
\ No newline at end of file

Propchange: logging/log4j/branches/log4j12-bz53299/modules/lf5/src/main/java/org/apache/log4j/lf5/DefaultLF5Configurator.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message