jukebox4-cvs Mailing List for Jukebox (Page 3)
Brought to you by:
vtt
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
(48) |
Apr
(33) |
May
(23) |
Jun
(55) |
Jul
(79) |
Aug
(48) |
Sep
(12) |
Oct
(23) |
Nov
(23) |
Dec
(4) |
---|
From: CVS B. <vt...@fr...> - 2000-09-14 23:02:01
|
User: vt Date: 00/09/14 16:01:46 Modified: src/java/gnu/j4/config PropertiesReader.java Log: Oops... Revision Changes Path 1.7 +3 -3 J4/src/java/gnu/j4/config/PropertiesReader.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java?annotate=1.7&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java.diff?r1=1.7&r2=1.6&cvsroot=jukebox4 ----------------------------------- Index: PropertiesReader.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/PropertiesReader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- PropertiesReader.java 2000/09/14 22:40:27 1.6 +++ PropertiesReader.java 2000/09/14 23:01:46 1.7 @@ -14,7 +14,7 @@ * Project</a> in general and code written by <a * href="mailto:maz...@sy...">Stefano Mazzocchi</a> in particular. * - * @version $Id: PropertiesReader.java,v 1.6 2000/09/14 22:40:27 vt Exp $ + * @version $Id: PropertiesReader.java,v 1.7 2000/09/14 23:01:46 vt Exp $ */ public class PropertiesReader extends ConfigReader { @@ -97,7 +97,7 @@ */ protected String unescape(String source) throws IOException { - System.err.println("Source: '" + source + "'"); +// System.err.println("Source: '" + source + "'"); StringBuffer target = new StringBuffer(); @@ -159,7 +159,7 @@ } String result = target.toString(); - System.out.println("Target: '" + result + "'"); +// System.out.println("Target: '" + result + "'"); return result; } } |
From: CVS B. <vt...@fr...> - 2000-09-14 22:40:49
|
User: vt Date: 00/09/14 15:40:27 Modified: src/java/gnu/j4/config PropertiesReader.java Log: Now the keys and values may contain the double quotes, and the double quotes will be handled properly (Why? Think of value consisting of 8 spaces with a dot in the middle) Revision Changes Path 1.6 +79 -2 J4/src/java/gnu/j4/config/PropertiesReader.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/PropertiesReader.java.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: PropertiesReader.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/PropertiesReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- PropertiesReader.java 1999/12/08 03:25:58 1.5 +++ PropertiesReader.java 2000/09/14 22:40:27 1.6 @@ -14,7 +14,7 @@ * Project</a> in general and code written by <a * href="mailto:maz...@sy...">Stefano Mazzocchi</a> in particular. * - * @version $Id: PropertiesReader.java,v 1.5 1999/12/08 03:25:58 vt Exp $ + * @version $Id: PropertiesReader.java,v 1.6 2000/09/14 22:40:27 vt Exp $ */ public class PropertiesReader extends ConfigReader { @@ -83,6 +83,83 @@ String key = line.substring( 0,idx ).trim(), value = line.substring( idx+1 ).trim(); - target.put( key,value ); + target.put(unescape(key), unescape(value)); + } + + /** + * Get rid of the quotes, unless they're escaped. + * + * @param source Original string, possibly escaped. + * + * @return The original string stripped from the quotes. + * + * @exception IOException if the double quote is not balanced. + */ + protected String unescape(String source) throws IOException { + + System.err.println("Source: '" + source + "'"); + + StringBuffer target = new StringBuffer(); + + // True if the current character is within the double quote + + boolean inQuote = false; + + // True if the previous character is a backslash (escape) + + boolean escaped = false; + + for ( int idx = 0; idx < source.length(); idx++ ) { + + char ch = source.charAt(idx); + + if ( ch == '"' ) { + + if ( escaped ) { + + // This double quote was escaped + + target.append(ch); + escaped = false; + + } else { + + // This double quote ends the escape + + escaped = false; + } + + } else { + + // Escape is good for one symbol only. If some other character + // except a double quote was escaped, we don't care and pass the + // escape on. In any case, escape flag is cleared. + + if ( escaped ) { + + target.append('\\'); + target.append(ch); + escaped = false; + + } else if ( ch == '\\' ) { + + escaped = true; + + } else { + + target.append(ch); + escaped = false; + } + } + } + + if ( escaped ) { + + throw new IOException("Unbalanced double quote: '" + source + "'"); + } + + String result = target.toString(); + System.out.println("Target: '" + result + "'"); + return result; } } |
From: CVS B. <vt...@fr...> - 2000-09-13 20:15:05
|
User: vt Date: 00/09/13 13:14:53 Modified: . configure.in Log: OK, THAT was major. Revision Changes Path 1.66 +3 -3 J4/configure.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?annotate=1.66&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in?rev=1.66&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/configure.in.diff?r1=1.66&r2=1.65&cvsroot=jukebox4 ----------------------------------- Index: configure.in =================================================================== RCS file: /usr/local/cvs/J4/configure.in,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- configure.in 2000/08/24 20:35:48 1.65 +++ configure.in 2000/09/13 20:14:53 1.66 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Id: configure.in,v 1.65 2000/08/24 20:35:48 vt Exp $)dnl +AC_REVISION($Id: configure.in,v 1.66 2000/09/13 20:14:53 vt Exp $)dnl dnl I'd like it to read the ./configure-options to allow both the basic set dnl of options, as well as the local set. @@ -28,8 +28,8 @@ AC_INIT(src/java/gnu/j4/core/Syslog.java) VERSION_MAJOR="2" -VERSION_MINOR="0" -PATCHLEVEL="9" +VERSION_MINOR="1" +PATCHLEVEL="0" AC_SUBST(VERSION_MAJOR)dnl AC_SUBST(VERSION_MINOR)dnl AC_SUBST(PATCHLEVEL)dnl |
From: CVS B. <vt...@fr...> - 2000-09-13 20:14:42
|
User: vt Date: 00/09/13 13:14:29 Modified: . ChangeLog Log: Documentation update Revision Changes Path 1.22 +9 -1 J4/ChangeLog CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog?annotate=1.22&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog?rev=1.22&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/ChangeLog.diff?r1=1.22&r2=1.21&cvsroot=jukebox4 ----------------------------------- Index: ChangeLog =================================================================== RCS file: /usr/local/cvs/J4/ChangeLog,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ChangeLog 2000/08/24 20:35:48 1.21 +++ ChangeLog 2000/09/13 20:14:29 1.22 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.21 2000/08/24 20:35:48 vt Exp $ +$Id: ChangeLog,v 1.22 2000/09/13 20:14:29 vt Exp $ CURRENT RELEASE NOTES @@ -18,6 +18,14 @@ JVM version and excludes these files from the build process. CHANGE LOG + +--- 2.1p0 Minor version bump (as opposed to patchlevel) caused by the + total reimplementation of the configuration and logging + system. Actually, it was rather shuffling of the pieces of + code back and forth, so the reliability is not likely to + suffer, though the functionality has changed a lot. + + A lot of dead code eliminated, a lot of code optimized. --- 2.0p9 Jakarta Regexp support added; XML configuration added, minor fixes. It is now possible to use both global and local |
From: CVS B. <vt...@fr...> - 2000-09-13 20:11:08
|
User: vt Date: 00/09/13 13:10:55 Modified: src/java/gnu/j4/core AbstractSyslog.java AbstractSyslogFilter.java JmxSyslog.java Logger.java Log: Bugfixes Revision Changes Path 1.2 +16 -10 J4/src/java/gnu/j4/core/AbstractSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslog.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslog.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslog.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: AbstractSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/AbstractSyslog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractSyslog.java 2000/09/13 19:23:33 1.1 +++ AbstractSyslog.java 2000/09/13 20:10:55 1.2 @@ -9,7 +9,7 @@ * facility. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 - * @version $Id: AbstractSyslog.java,v 1.1 2000/09/13 19:23:33 vt Exp $ + * @version $Id: AbstractSyslog.java,v 1.2 2000/09/13 20:10:55 vt Exp $ * @since Jukebox v4 2.0.p10 */ abstract public class AbstractSyslog implements Syslog, LogLevels, LogConfigKeywords { @@ -34,7 +34,7 @@ * * This attribute is immutable, once set, cannot be changed. */ - private String configurationRoot; + private String configurationRoot = null; /** * Master configuration. @@ -53,7 +53,7 @@ public final void setConfigurationRoot(String configurationRoot) { - if ( configurationRoot != null ) { + if ( this.configurationRoot != null ) { throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); } @@ -73,7 +73,7 @@ // Configure the filter String filterConfigurationRoot = configurationRoot + ".filter"; - String filterClassName = conf.getString(configurationRoot + ".classname"); + String filterClassName = conf.getString(filterConfigurationRoot + ".classname"); if ( filterClassName != null ) { @@ -84,16 +84,17 @@ filter.setConfigurationRoot(filterConfigurationRoot); filter.configure(conf); + // VT: FIXME: This message gets logged before the log is + // opened. Consequently, it doesn't show up at all. + + logMessage(new LogRecord(Thread.currentThread(), + this, LOG_ERR, Logger.LOG_LOGGER, + "Using "+filter.getClass().getName(), null)); + } catch ( Throwable t ) { System.err.println("Unrecoverable exception, filter is not set:"); t.printStackTrace(); - - } finally { - - logMessage(new LogRecord(Thread.currentThread(), - this, LOG_INFO, Logger.LOG_LOGGER, - "Using "+filter.getClass().getName(), null)); } } @@ -102,6 +103,11 @@ public void open() { + if ( conf == null ) { + + throw new IllegalStateException(getConfigurationRoot() + ": can't open if not configured"); + } + try { start(); 1.2 +3 -3 J4/src/java/gnu/j4/core/AbstractSyslogFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: AbstractSyslogFilter.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractSyslogFilter.java 2000/09/13 19:25:50 1.1 +++ AbstractSyslogFilter.java 2000/09/13 20:10:55 1.2 @@ -9,10 +9,10 @@ * Allows the log facilities to be filtered from the output. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 - * @version $Id: AbstractSyslogFilter.java,v 1.1 2000/09/13 19:25:50 vt Exp $ + * @version $Id: AbstractSyslogFilter.java,v 1.2 2000/09/13 20:10:55 vt Exp $ * @since Jukebox v4 2.0p10 */ -public abstract class AbstractSyslogFilter implements Configurable, LogLevels, LogConfigKeywords { +public abstract class AbstractSyslogFilter implements Configurable, LogLevels, LogConfigKeywords, SyslogFilter { private String configurationRoot; @@ -53,7 +53,7 @@ public final void setConfigurationRoot(String configurationRoot) { - if ( configurationRoot != null ) { + if ( this.configurationRoot != null ) { throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); } 1.7 +2 -2 J4/src/java/gnu/j4/core/JmxSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java?annotate=1.7&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java.diff?r1=1.7&r2=1.6&cvsroot=jukebox4 ----------------------------------- Index: JmxSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/JmxSyslog.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JmxSyslog.java 2000/09/13 19:23:33 1.6 +++ JmxSyslog.java 2000/09/13 20:10:55 1.7 @@ -31,7 +31,7 @@ * When invoked, becomes a wrapper for the actual log agent. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 - * @version $Id: JmxSyslog.java,v 1.6 2000/09/13 19:23:33 vt Exp $ + * @version $Id: JmxSyslog.java,v 1.7 2000/09/13 20:10:55 vt Exp $ * @since Jukebox 2.0p5 */ public class JmxSyslog extends NotificationBroadcasterSupport implements Syslog, DynamicMBean, NotificationBroadcaster { @@ -271,7 +271,7 @@ public final void setConfigurationRoot(String configurationRoot) { - if ( configurationRoot != null ) { + if ( this.configurationRoot != null ) { throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); } 1.19 +3 -1 J4/src/java/gnu/j4/core/Logger.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java?annotate=1.19&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java?rev=1.19&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java.diff?r1=1.19&r2=1.18&cvsroot=jukebox4 ----------------------------------- Index: Logger.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/Logger.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Logger.java 2000/09/13 19:38:37 1.18 +++ Logger.java 2000/09/13 20:10:55 1.19 @@ -9,7 +9,7 @@ * Performs the message logging in the background, with a minimal priority. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 - * @version $Id: Logger.java,v 1.18 2000/09/13 19:38:37 vt Exp $ + * @version $Id: Logger.java,v 1.19 2000/09/13 20:10:55 vt Exp $ * @since Jukebox v4 */ public class Logger extends Thread implements LogLevels, LogConfigKeywords { @@ -198,6 +198,8 @@ System.exit(1); } + syslog.setConfigurationRoot("syslog"); + syslog.configure(conf); syslog.open(); maxage = conf.getLong(SYSLOG_QUEUE_MAXAGE, 5000); |
From: CVS B. <vt...@fr...> - 2000-09-13 20:08:19
|
User: vt Date: 00/09/13 13:07:44 Modified: src/scripts j4wrapper.in Log: Oops... Revision Changes Path 1.7 +2 -1 J4/src/scripts/j4wrapper.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in?annotate=1.7&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in.diff?r1=1.7&r2=1.6&cvsroot=jukebox4 ----------------------------------- Index: j4wrapper.in =================================================================== RCS file: /usr/local/cvs/J4/src/scripts/j4wrapper.in,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- j4wrapper.in 2000/08/24 20:35:51 1.6 +++ j4wrapper.in 2000/09/13 20:07:44 1.7 @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: j4wrapper.in,v 1.6 2000/08/24 20:35:51 vt Exp $ +# $Id: j4wrapper.in,v 1.7 2000/09/13 20:07:44 vt Exp $ # # This script is used to run the classes extending the # gnu.j4.service.RunnableService. Please see the documentation - the wrapper @@ -12,6 +12,7 @@ @JMX_CLASSES@:\ @JMXTOOLS_CLASSES@:\ @XERCES_CLASSES@:\ +@REGEXP_CLASSES@:\ ${CLASSPATH} JAVA_OPT="@JAVA_OPT@" |
From: CVS B. <vt...@fr...> - 2000-09-13 19:38:50
|
User: vt Date: 00/09/13 12:38:37 Modified: src/java/gnu/j4/core Logger.java Log: Activated the changes - who would want to see the empty log? :) Revision Changes Path 1.18 +4 -1 J4/src/java/gnu/j4/core/Logger.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java?annotate=1.18&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java?rev=1.18&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Logger.java.diff?r1=1.18&r2=1.17&cvsroot=jukebox4 ----------------------------------- Index: Logger.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/Logger.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Logger.java 2000/06/20 06:35:45 1.17 +++ Logger.java 2000/09/13 19:38:37 1.18 @@ -9,7 +9,7 @@ * Performs the message logging in the background, with a minimal priority. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 - * @version $Id: Logger.java,v 1.17 2000/06/20 06:35:45 vt Exp $ + * @version $Id: Logger.java,v 1.18 2000/09/13 19:38:37 vt Exp $ * @since Jukebox v4 */ public class Logger extends Thread implements LogLevels, LogConfigKeywords { @@ -198,6 +198,8 @@ System.exit(1); } + syslog.open(); + maxage = conf.getLong(SYSLOG_QUEUE_MAXAGE, 5000); maxsize = conf.getInteger(SYSLOG_QUEUE_MAXSIZE, 1000); @@ -274,6 +276,7 @@ LOG_LOGGER, "interrupted, terminating", null)); + syslog.close(); theLogger = null; return; } |
From: CVS B. <vt...@fr...> - 2000-09-13 19:26:03
|
User: vt Date: 00/09/13 12:25:50 Added: src/java/gnu/j4/core AbstractSyslogFilter.java Log: Oops, another one. Revision Changes Path 1.1 J4/src/java/gnu/j4/core/AbstractSyslogFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslogFilter.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: AbstractSyslogFilter.java =================================================================== package gnu.j4.core; import gnu.j4.config.Configurable; import gnu.j4.config.Configuration; /** * Syslog facility filter. * * Allows the log facilities to be filtered from the output. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: AbstractSyslogFilter.java,v 1.1 2000/09/13 19:25:50 vt Exp $ * @since Jukebox v4 2.0p10 */ public abstract class AbstractSyslogFilter implements Configurable, LogLevels, LogConfigKeywords { private String configurationRoot; /** * Master configuration. */ protected Configuration conf; /** * Find out if the combination of the log level and facility is enabled. * * @param ll Log level. * * @param facility Log facility. * * @return true if the given combination is allowed to be written. * * @deprecated Use {@link #isEnabled(gnu.j4.core.LogRecord) * isEnabled(LogRecord)} instead. This method used to be abstract, * currently, to support the compatibility, it creates a dummy log * record with the given log level and facility, which is an overhead * and is to be avoided. */ public boolean isEnabled(LogLevel ll, String facility) { return isEnabled(new LogRecord(null, null, ll, facility, null, null)); } /** * Find out if we should pass this record down the chain. * * @param lr Log record to analyze. * * @return <code>true</code> if the filter configuration allows this * record to be passed to the log device further down the chain. */ public abstract boolean isEnabled(LogRecord lr); public final void setConfigurationRoot(String configurationRoot) { if ( configurationRoot != null ) { throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); } this.configurationRoot = configurationRoot; } public final String getConfigurationRoot() { return configurationRoot; } } |
From: CVS B. <vt...@fr...> - 2000-09-13 19:24:19
|
User: vt Date: 00/09/13 12:24:07 Modified: src/java/gnu/j4/config Configurable.java Log: Oops, this belongs to the previous commit. Revision Changes Path 1.2 +15 -1 J4/src/java/gnu/j4/config/Configurable.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configurable.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configurable.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configurable.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: Configurable.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Configurable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Configurable.java 2000/09/13 00:02:35 1.1 +++ Configurable.java 2000/09/13 19:24:07 1.2 @@ -16,7 +16,7 @@ * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998-2000 * - * @version $Id: Configurable.java,v 1.1 2000/09/13 00:02:35 vt Exp $ + * @version $Id: Configurable.java,v 1.2 2000/09/13 19:24:07 vt Exp $ */ public interface Configurable { @@ -29,8 +29,22 @@ * @exception IllegalStateException if it turns out {@link * #getConfigurationRoot getConfigurationRoot()} did return null. We * cannot proceed without knowing where our configuration is. + * + * @exception IllegalArgumentException if the configuration values are + * unusable. */ public void configure(Configuration conf); + + /** + * Set the path to the root configuration element. + * + * @param configurationRoot Dot delimited string defining the way from + * the configuration top to the configuration element defining the + * configuration for this object. + * + * @exception IllegalStateException must be thrown if the configuration root has already been set. + */ + public void setConfigurationRoot(String configurationRoot); /** * Get the path to the root configuration element. |
From: CVS B. <vt...@fr...> - 2000-09-13 19:23:48
|
User: vt Date: 00/09/13 12:23:33 Modified: src/java/gnu/j4/core BasicSyslog.java JmxSyslog.java LogMultiplexor.java Makefile.am RegexpFacilityFilter.java RexFacilityFilter.java SwitchFacilityFilter.java Syslog.java SyslogFacilityFilter.java UdpSyslog.java Added: src/java/gnu/j4/core AbstractSyslog.java PatternFilter.java SwitchFilter.java SyslogFilter.java Log: Reworked the configuration model, cleaned up the implementation. Most probably, a lot of other code will break now, but the configuration should stay the same, I guess. To be continued... Revision Changes Path 1.17 +10 -94 J4/src/java/gnu/j4/core/BasicSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java?annotate=1.17&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java?rev=1.17&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java.diff?r1=1.17&r2=1.16&cvsroot=jukebox4 ----------------------------------- Index: BasicSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/BasicSyslog.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- BasicSyslog.java 2000/08/24 20:35:50 1.16 +++ BasicSyslog.java 2000/09/13 19:23:33 1.17 @@ -43,11 +43,11 @@ * something less complicated, at least for the production versions. * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: BasicSyslog.java,v 1.16 2000/08/24 20:35:50 vt Exp $ + * @version $Id: BasicSyslog.java,v 1.17 2000/09/13 19:23:33 vt Exp $ * @since Jukebox v4 * @see LogConfigKeywords */ -public class BasicSyslog implements Syslog, LogLevels, LogConfigKeywords { +public class BasicSyslog extends AbstractSyslog { /** * Default timestamp format. @@ -59,20 +59,6 @@ public static final String DEFAULT_DATEFORMAT = "HH:mm:ss:SSS"; /** - * Configuration. - * - * Loaded using the {@link gnu.j4.config.Configuration#createChain - * Configuration#createChain} method, so it's possible to have global, - * user and local config settings. - * - * <p> - * - * The configuration settings are duplicated in this object so we don't - * waste time looking for them logging every single message. - */ - protected Configuration conf; - - /** * Object used to format the timestamp for the output. * * @see LogConfigKeywords#DATEFORMAT_CF @@ -80,11 +66,6 @@ protected SimpleDateFormat dateFormatter; /** - * Facility filter. - */ - protected SyslogFacilityFilter filter = null; - - /** * <code>true</code> if we should display a delay. */ protected boolean shouldDisplayDelay = false; @@ -159,44 +140,10 @@ } - Class filterClass = null; - - try { - String filterClassName = conf.getString(SYSLOG_FILTER_CLASS, "gnu.j4.core.SwitchFacilityFilter"); - - filterClass = Class.forName( filterClassName ); - filter = (SyslogFacilityFilter)filterClass.newInstance(); - filter.init(getConfigFileName()); - - } catch ( ClassNotFoundException cnfex ) { - createDefaultFilter(cnfex); - } catch ( IllegalAccessException iaex ) { - createDefaultFilter(iaex); - } catch ( InstantiationException iex ) { - createDefaultFilter(iex); - } catch ( Throwable t ) { - - System.out.println("Unrecoverable exception, expect further problems:"); - t.printStackTrace(); - - } finally { - logMessage(new LogRecord(Thread.currentThread(), - this, LOG_INFO, Logger.LOG_LOGGER, - "Using "+filter.getClass().getName(), null)); - } - shouldDisplayDelay = conf.getBoolean(DATEFORMAT_DELAY_CF, true); shouldDisplayOwnership = conf.getBoolean(FORMAT_OWNERSHIP_CF, true); } - private void createDefaultFilter(Throwable t) { - filter = new SwitchFacilityFilter(); - filter.init(getConfigFileName()); - logMessage(new LogRecord(Thread.currentThread(), - this, LOG_ERR, "SyslogFilter", - "Can't create the filter, reverting to default", t)); - } - /** * Return the <code>basename(1)</code> of the log configuration file. * @@ -209,53 +156,17 @@ /** * Log the message. * - * - * The resulting string message is first checked against the {@link - * #filter filter}, then, if not rejected, composed and passed to the - * {@link #write write} method to be written to the - * <code>System.out</code>. So if you like the format but want to - * redirect the log output, go to {@link #write write}. - * * @param lr Message to write. */ - public final void logMessage( LogRecord lr ) { - if ( !filter( lr ) ) { - return; - } + public final void write(LogRecord lr) { StringBuffer buffer = new StringBuffer(); - composeMessage( buffer,lr ); - write( buffer.toString() ); + composeMessage(buffer, lr); + write(buffer.toString()); } /** - * This method is intended to provide a level and channel filter. - * - - * Result is used in the {@link #logMessage logMessage} to determine - * whether to actually log this message or not. - - * @param lr Log record to check. - * @return true if the configuration allows this message to be written into the log. - */ - public boolean filter( LogRecord lr ) { - - if ( lr == null ) { - - // VT: FIXME: consider logging this through the normal channels - - (new Error( "null log record, you may want to check what's going on" )).printStackTrace(); - } - - if ( !filter.isEnabled(lr.ll, lr.facility) ) { - return false; - } - - return true; - } - - /** * Compose the string representation of the log record. * @param lr Log record to compose the message from. * @return The log line. @@ -483,5 +394,10 @@ */ public void write( String message ) { System.out.println( message ); + } + + protected void start() { + } + protected void stop() { } } 1.6 +56 -1 J4/src/java/gnu/j4/core/JmxSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/JmxSyslog.java.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: JmxSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/JmxSyslog.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JmxSyslog.java 2000/06/21 18:10:05 1.5 +++ JmxSyslog.java 2000/09/13 19:23:33 1.6 @@ -21,6 +21,7 @@ import javax.management.NotificationFilter; import javax.management.NotificationListener; +import gnu.j4.config.Configuration; import gnu.j4.jmx.*; /** @@ -30,7 +31,7 @@ * When invoked, becomes a wrapper for the actual log agent. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 - * @version $Id: JmxSyslog.java,v 1.5 2000/06/21 18:10:05 vt Exp $ + * @version $Id: JmxSyslog.java,v 1.6 2000/09/13 19:23:33 vt Exp $ * @since Jukebox 2.0p5 */ public class JmxSyslog extends NotificationBroadcasterSupport implements Syslog, DynamicMBean, NotificationBroadcaster { @@ -260,4 +261,58 @@ throw new Error("Not Implemented"); } */ + + public void configure(Configuration conf) { + + // Hmm? + } + + private String configurationRoot; + + public final void setConfigurationRoot(String configurationRoot) { + + if ( configurationRoot != null ) { + + throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); + } + + this.configurationRoot = configurationRoot; + } + + public final String getConfigurationRoot() { + + return configurationRoot; + } + + /** + * True if enabled. + * + * @see #open + * @see #close + */ + private boolean enabled = false; + + public void open() { + + try { + +// start(); + enabled = true; + + } catch ( Throwable t ) { + + // Well, this is very unfortunate. It is not possible to display + // the error through the normal logging channel, the only option + // left is write it to stderr. + + System.err.println(getConfigurationRoot() + ": can't open, cause:"); + t.printStackTrace(); + } + } + + public void close() { + + enabled = false; +// stop(); + } } 1.2 +33 -47 J4/src/java/gnu/j4/core/LogMultiplexor.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogMultiplexor.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogMultiplexor.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogMultiplexor.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: LogMultiplexor.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/LogMultiplexor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LogMultiplexor.java 2000/09/13 00:02:35 1.1 +++ LogMultiplexor.java 2000/09/13 19:23:33 1.2 @@ -1,7 +1,7 @@ package gnu.j4.core; import java.util.Enumeration; -import java.util.Vector; +import java.util.Hashtable; import gnu.j4.config.Configurable; import gnu.j4.config.Configuration; @@ -11,43 +11,32 @@ * * Provides an ability to log to multiple atomic logging devices. * + * <p> + * + * It is not recommended to have filter installed in the multiplexor, + * because the different media has different properties where it gets to + * usability (for example, it is not advisable to enable all the levels + * for the console log, though it's perfectly OK to do so for the file + * log). + * + * <p> + * + * However, this provides an excellent quick start easily configurable + * solution and/or generic debug filter. + * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 - * @version $Id: LogMultiplexor.java,v 1.1 2000/09/13 00:02:35 vt Exp $ + * @version $Id: LogMultiplexor.java,v 1.2 2000/09/13 19:23:33 vt Exp $ * @since Jukebox v4 2.0.p10 * @see LogConfigKeywords */ -public class LogMultiplexor implements Syslog, LogLevels, LogConfigKeywords { +public class LogMultiplexor extends AbstractSyslog { /** - * Master configuration. - */ - protected Configuration conf; - - /** * Collection of the logging devices attached to the multiplexor. */ - private Vector targets = new Vector(); + private Hashtable targets = new Hashtable(); - /** - * The log filter. - * - * It is not recommended to have filter installed in the multiplexor, - * because the different media has different properties where it gets to - * usability (for example, it is not advisable to enable all the levels - * for the console log, though it's perfectly OK to do so for the file - * log). - * - * <p> - * - * However, this provides an excellent quick start easily configurable - * solution and/or generic debug filter. - */ - private SyslogFacilityFilter filter = null; - public LogMultiplexor() { - - conf = Configuration.createChain(getConfigFileName()); - configurationChanged(); } /** @@ -55,16 +44,21 @@ */ public void configurationChanged() { - Vector currentNames = new Vector(); - + // VT: FIXME: For now, I'll just kill off all the existing devices + // and reinitialize them, if required. + for ( Enumeration e = targets.elements(); e.hasMoreElements(); ) { - currentNames.addElement(((Configurable)e.nextElement()).getConfigurationRoot()); + Syslog target = (Syslog)targets.get(e.nextElement()); + + target.close(); } // Now that we've collected the names, let's figure out who to kill // and who to leave alone. The configuration has been changed by // now. + + } /** @@ -85,27 +79,19 @@ */ public void add(Syslog syslog) { - targets.addElement(syslog); + targets.put(syslog.getConfigurationRoot(), syslog); } - public void logMessage(LogRecord message) { + public void write(LogRecord message) { - if ( filter == null || filter.isEnabled(message.ll, message.facility) ) { + for ( Enumeration e = targets.elements(); e.hasMoreElements(); ) { - for ( Enumeration e = targets.elements(); e.hasMoreElements(); ) { - - ((Syslog)e.nextElement()).logMessage(message); - } + ((Syslog)e.nextElement()).logMessage(message); } } - - /** - * Return the <code>basename(1)</code> of the log configuration file. - * - * @return {@link LogConfigKeywords#LOG_CF_FILE LogConfigKeywords#LOG_CF_FILE}. - */ - protected String getConfigFileName() { - return LOG_CF_FILE; - } + protected void start() { + } + protected void stop() { + } } 1.19 +7 -4 J4/src/java/gnu/j4/core/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am?annotate=1.19&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am?rev=1.19&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am.diff?r1=1.19&r2=1.18&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Makefile.am 2000/09/13 00:02:35 1.18 +++ Makefile.am 2000/09/13 19:23:33 1.19 @@ -1,9 +1,12 @@ -# $Id: Makefile.am,v 1.18 2000/09/13 00:02:35 vt Exp $ +# $Id: Makefile.am,v 1.19 2000/09/13 19:23:33 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package BASE_FILES = ANSI.java \ + SyslogFilter.java\ + AbstractSyslogFilter.java \ + AbstractSyslog.java \ AnsiSyslog.java \ BasicSyslog.java \ FileSyslog.java \ @@ -18,10 +21,10 @@ SerializableLogRecord.java \ SimpleQueue.java \ Syslog.java \ - SwitchFacilityFilter.java \ - SyslogFacilityFilter.java \ + SwitchFilter.java \ TimedOutException.java \ - LogMultiplexor.java + LogMultiplexor.java \ + PatternFilter.java JAVA2_FILES = UdpSyslog.java 1.7 +13 -89 J4/src/java/gnu/j4/core/RegexpFacilityFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RegexpFacilityFilter.java?annotate=1.7&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RegexpFacilityFilter.java?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RegexpFacilityFilter.java.diff?r1=1.7&r2=1.6&cvsroot=jukebox4 ----------------------------------- Index: RegexpFacilityFilter.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/RegexpFacilityFilter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RegexpFacilityFilter.java 2000/08/04 23:21:46 1.6 +++ RegexpFacilityFilter.java 2000/09/13 19:23:33 1.7 @@ -21,104 +21,28 @@ * required to use this filter, see the documentation for details. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: RegexpFacilityFilter.java,v 1.6 2000/08/04 23:21:46 vt Exp $ + * @version $Id: RegexpFacilityFilter.java,v 1.7 2000/09/13 19:23:33 vt Exp $ */ -public class RegexpFacilityFilter extends SyslogFacilityFilter implements LogConfigKeywords { +public class RegexpFacilityFilter extends PatternFilter { - /** - * Collection of preprocessed patterns to match. - * - * The patterns are specified with the keyword defined by {@link - * LogConfigKeywords#SYSLOG_REX_PATTERN SYSLOG_REX_PATTERN}. - */ - protected Vector patternSet = new Vector(); + protected Pattern createPattern(boolean include, String pattern) throws Throwable { - public void init(String confName) { - super.init(confName); - - Configuration defaultCfg = new Configuration(); - - Vector defaultPattern = new Vector(); - - defaultPattern.addElement(".*"); - defaultPattern.addElement("-\\.DEBUG"); - defaultCfg.put(SYSLOG_REX_PATTERN, defaultPattern); - - conf = Configuration.createChain(confName, defaultCfg); - - try { - - Vector stringPatternSet = conf.getVector(SYSLOG_REX_PATTERN); - - for ( Enumeration e = stringPatternSet.elements(); e.hasMoreElements(); ) { - - String raw = e.nextElement().toString(); - - // First character is '-' (exclude) or '+' or anything else (include). - - boolean include = true; - int patternIndex = 0; - - if ( raw.charAt(0) == '-' ) { - include = false; - patternIndex = 1; - } else if ( raw.charAt(0) == '+' ) { - patternIndex = 1; - } - - String sPattern = raw.substring(patternIndex, raw.length()-1); - RE pattern = new RE(sPattern); - Pattern p = new Pattern(include, pattern); - -// System.err.println("Pattern: " + sPattern); - patternSet.addElement(p); - } - - } catch ( RESyntaxException resex ) { - throw new Error( resex.toString() ); - } + return new RegexpPattern(include, pattern); } - /** - * Find out if the combination of the log level and facility is enabled. - * - * @param ll Log level. - * @param facility Log facility. - * @return true if the given combination is allowed to be written. - */ - public boolean isEnabled( LogLevel ll, String facility ) { - - // First of all, let's glue the level and facility together - - String target = (facility == null)?"NULL_FACILITY":facility - + "." - + ((ll == null)?"NO_LEVEL":ll.toString()); -// System.err.println("Search: " + target); - - boolean include = false; - - for ( Enumeration e = patternSet.elements(); e.hasMoreElements(); ) { + protected class RegexpPattern extends Pattern { + + private RE pattern; - Pattern p = (Pattern)e.nextElement(); + protected RegexpPattern(boolean include, String pattern) throws Throwable { - if ( p.pattern.match(target) ) { + super(include); + this.pattern = new RE(pattern); + } -// System.err.println("Match (" + p.include + "): "+ match.toString()); - include = p.include; - } + protected boolean match(String pattern) { - } -// System.err.println("Final: " + target + ": " + include ); - return include; - } - - protected class Pattern { - boolean include = true; - RE pattern = null; - - private Pattern(boolean include, RE pattern) { - this.include = include; - this.pattern = pattern; + return this.pattern.match(pattern); } } } 1.2 +28 -92 J4/src/java/gnu/j4/core/RexFacilityFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RexFacilityFilter.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RexFacilityFilter.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/RexFacilityFilter.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- Index: RexFacilityFilter.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/RexFacilityFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RexFacilityFilter.java 2000/08/04 23:21:46 1.1 +++ RexFacilityFilter.java 2000/09/13 19:23:33 1.2 @@ -19,110 +19,46 @@ * documentation for details. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: RexFacilityFilter.java,v 1.1 2000/08/04 23:21:46 vt Exp $ + * @version $Id: RexFacilityFilter.java,v 1.2 2000/09/13 19:23:33 vt Exp $ */ -public class RexFacilityFilter extends SyslogFacilityFilter implements LogConfigKeywords { +public class RexFacilityFilter extends PatternFilter { - /** - * Collection of preprocessed patterns to match. - * - * The patterns are specified with the keyword defined by {@link - * LogConfigKeywords#SYSLOG_REX_PATTERN SYSLOG_REX_PATTERN}. - */ - protected Vector patternSet = new Vector(); - - public void init(String confName) { - super.init(confName); - - Configuration defaultCfg = new Configuration(); - - Vector defaultPattern = new Vector(); +// Rex pattern = Rex.build(sPattern); + +// int length = target.length(); +// char buf[] = new char[length]; - defaultPattern.addElement(".*"); - defaultPattern.addElement("-\\.DEBUG"); - defaultCfg.put(SYSLOG_REX_PATTERN, defaultPattern); +// target.getChars(0, length, buf, 0); - conf = Configuration.createChain(confName, defaultCfg); +// RexResult match = p.pattern.match(buf, 0, length); - try { - - Vector stringPatternSet = conf.getVector(SYSLOG_REX_PATTERN); - - for ( Enumeration e = stringPatternSet.elements(); e.hasMoreElements(); ) { - - String raw = e.nextElement().toString(); - - // First character is '-' (exclude) or '+' or anything else (include). - - boolean include = true; - int patternIndex = 0; +// if ( match != null ) { - if ( raw.charAt(0) == '-' ) { - include = false; - patternIndex = 1; - } else if ( raw.charAt(0) == '+' ) { - patternIndex = 1; - } - - String sPattern = raw.substring(patternIndex, raw.length()-1); - Rex pattern = Rex.build(sPattern); - Pattern p = new Pattern(include, pattern); - -// System.err.println("Pattern: " + sPattern); - patternSet.addElement(p); - } - - } catch ( RegExprSyntaxException resex ) { - throw new Error( resex.toString() ); - } - } + protected Pattern createPattern(boolean include, String pattern) throws Throwable { - /** - * Find out if the combination of the log level and facility is enabled. - * - * @param ll Log level. - * @param facility Log facility. - * @return true if the given combination is allowed to be written. - */ - public boolean isEnabled( LogLevel ll, String facility ) { + return new RexPattern(include, pattern); + } - // First of all, let's glue the level and facility together - - String target = (facility == null)?"NULL_FACILITY":facility - + "." - + ((ll == null)?"NO_LEVEL":ll.toString()); -// System.err.println("Search: " + target); - - int length = target.length(); - char buf[] = new char[length]; - - target.getChars(0, length, buf, 0); - - boolean include = false; - - for ( Enumeration e = patternSet.elements(); e.hasMoreElements(); ) { + protected class RexPattern extends Pattern { + + private Rex pattern; - Pattern p = (Pattern)e.nextElement(); - RexResult match = p.pattern.match(buf, 0, length); + protected RexPattern(boolean include, String pattern) throws Throwable { - if ( match != null ) { + super(include); + this.pattern = Rex.build(pattern); + } -// System.err.println("Match (" + p.include + "): "+ match.toString()); - include = p.include; - } + protected boolean match(String pattern) { - } -// System.err.println("Final: " + target + ": " + include ); - return include; - } - - protected class Pattern { - boolean include = true; - Rex pattern = null; - - private Pattern(boolean include, Rex pattern) { - this.include = include; - this.pattern = pattern; + int length = pattern.length(); + char buf[] = new char[length]; + + pattern.getChars(0, length, buf, 0); + + return (this.pattern.match(buf, 0, length) != null ) + ? true + : false; } } } 1.5 +2 -2 J4/src/java/gnu/j4/core/SwitchFacilityFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SwitchFacilityFilter.java?annotate=1.5&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SwitchFacilityFilter.java?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SwitchFacilityFilter.java.diff?r1=1.5&r2=1.4&cvsroot=jukebox4 ----------------------------------- Index: SwitchFacilityFilter.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/SwitchFacilityFilter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SwitchFacilityFilter.java 1999/09/28 22:04:08 1.4 +++ SwitchFacilityFilter.java 2000/09/13 19:23:33 1.5 @@ -46,9 +46,9 @@ * list, one of the messages on December 29 1998. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: SwitchFacilityFilter.java,v 1.4 1999/09/28 22:04:08 vt Exp $ + * @version $Id: SwitchFacilityFilter.java,v 1.5 2000/09/13 19:23:33 vt Exp $ */ -public class SwitchFacilityFilter extends SyslogFacilityFilter { +public class SwitchFacilityFilter extends AbstractSyslogFilter { public void init(String confName) { super.init(confName); 1.4 +7 -2 J4/src/java/gnu/j4/core/Syslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Syslog.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Syslog.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Syslog.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: Syslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/Syslog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Syslog.java 1999/06/29 04:35:34 1.3 +++ Syslog.java 2000/09/13 19:23:33 1.4 @@ -1,5 +1,7 @@ package gnu.j4.core; +import gnu.j4.config.Configurable; + /** * Syslog facility. * @@ -18,9 +20,9 @@ * shouldn't do it the second time. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: Syslog.java,v 1.3 1999/06/29 04:35:34 vt Exp $ + * @version $Id: Syslog.java,v 1.4 2000/09/13 19:23:33 vt Exp $ */ -public interface Syslog { +public interface Syslog extends Configurable { /** * Log facility to use for all the classes implementing this interface. @@ -34,4 +36,7 @@ * @param message Message to log. */ public void logMessage( LogRecord message ); + + public void open(); + public void close(); } 1.4 +10 -16 J4/src/java/gnu/j4/core/SyslogFacilityFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SyslogFacilityFilter.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SyslogFacilityFilter.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SyslogFacilityFilter.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: SyslogFacilityFilter.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/SyslogFacilityFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SyslogFacilityFilter.java 1999/06/29 04:35:34 1.3 +++ SyslogFacilityFilter.java 2000/09/13 19:23:33 1.4 @@ -7,24 +7,18 @@ * * Allows the log facilities to be filtered from the output. * + * @deprecated Use {@link SyslogFilter SyslogFilter} instead. Left here only + * for compatibility purposes. Will go away in the next release. + * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1999 - * @version $Id: SyslogFacilityFilter.java,v 1.3 1999/06/29 04:35:34 vt Exp $ + * @version $Id: SyslogFacilityFilter.java,v 1.4 2000/09/13 19:23:33 vt Exp $ */ -public abstract class SyslogFacilityFilter implements LogLevels, LogConfigKeywords { - - protected String confName; - protected Configuration conf; - - public void init(String confName) { - this.confName = confName; - } - +public abstract class SyslogFacilityFilter extends AbstractSyslogFilter { + /** - * Find out if the combination of the log level and facility is enabled. - * - * @param ll Log level. - * @param facility Log facility. - * @return true if the given combination is allowed to be written. + * @deprecated The configuration model doesn't use the configuration + * file name anymore. */ - public abstract boolean isEnabled(LogLevel ll, String facility); + public void init(String confName) { + } } 1.11 +1 -22 J4/src/java/gnu/j4/core/UdpSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/UdpSyslog.java?annotate=1.11&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/UdpSyslog.java?rev=1.11&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/UdpSyslog.java.diff?r1=1.11&r2=1.10&cvsroot=jukebox4 ----------------------------------- Index: UdpSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/UdpSyslog.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- UdpSyslog.java 2000/07/08 04:58:38 1.10 +++ UdpSyslog.java 2000/09/13 19:23:33 1.11 @@ -48,7 +48,7 @@ * href="http://www.digitalfocus.com/faq" target="_top">The Java Developer * Archive: How Do I...</a> by Jeremy Cooper * @author <a href="mailto:vt...@fr...">Vadim Tkachenko</a> - * @version $Id: UdpSyslog.java,v 1.10 2000/07/08 04:58:38 vt Exp $ + * @version $Id: UdpSyslog.java,v 1.11 2000/09/13 19:23:33 vt Exp $ */ public class UdpSyslog extends BasicSyslog { @@ -249,27 +249,6 @@ buffer.append( Integer.toString( localPort ) ); buffer.append( "] " ); super.composeMessage( buffer,lr ); - } - - /** - * Decide which messages to log. - * - * This method overrides the behavior of its {@link BasicSyslog#filter - * parent class' method}. - * - * @return If the facility starts with {@link #SYSLOG_STD_PREFIX - * SYSLOG_STD_PREFIX}, true. Otherwise, say what the parent says. - * @see #isLevelEnabled - */ - public boolean filter( LogRecord lr ) { - - if ( lr.facility != null - && lr.facility.toLowerCase().startsWith( SYSLOG_STD_PREFIX ) ) { - - // Let the syslogd sort it out - return true; - } - return super.filter( lr ); } /** 1.1 J4/src/java/gnu/j4/core/AbstractSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslog.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/AbstractSyslog.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: AbstractSyslog.java =================================================================== package gnu.j4.core; import gnu.j4.config.Configurable; import gnu.j4.config.Configuration; /** * This class provides the implementation for the common features of all the * syslogs, such as configuration support, start/stop control and filtering * facility. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: AbstractSyslog.java,v 1.1 2000/09/13 19:23:33 vt Exp $ * @since Jukebox v4 2.0.p10 */ abstract public class AbstractSyslog implements Syslog, LogLevels, LogConfigKeywords { /** * True if enabled. * * @see #open * @see #close */ private boolean enabled = false; /** * Facility filter. * * May be <code>null</code>, in this case no filtering happens at all. */ private SyslogFilter filter = null; /** * The configuration root. * * This attribute is immutable, once set, cannot be changed. */ private String configurationRoot; /** * Master configuration. */ protected Configuration conf; public AbstractSyslog() { } public AbstractSyslog(String configurationRoot, Configuration conf) { this.configurationRoot = configurationRoot; configure(conf); } public final void setConfigurationRoot(String configurationRoot) { if ( configurationRoot != null ) { throw new IllegalStateException("You cannot reset the configuration root. Destroy this one and instantiate new."); } this.configurationRoot = configurationRoot; } public final String getConfigurationRoot() { return configurationRoot; } public void configure(Configuration conf) { this.conf = conf; // Configure the filter String filterConfigurationRoot = configurationRoot + ".filter"; String filterClassName = conf.getString(configurationRoot + ".classname"); if ( filterClassName != null ) { try { Class filterClass = Class.forName( filterClassName ); filter = (SyslogFilter)filterClass.newInstance(); filter.setConfigurationRoot(filterConfigurationRoot); filter.configure(conf); } catch ( Throwable t ) { System.err.println("Unrecoverable exception, filter is not set:"); t.printStackTrace(); } finally { logMessage(new LogRecord(Thread.currentThread(), this, LOG_INFO, Logger.LOG_LOGGER, "Using "+filter.getClass().getName(), null)); } } } public void open() { try { start(); enabled = true; } catch ( Throwable t ) { // Well, this is very unfortunate. It is not possible to display // the error through the normal logging channel, the only option // left is write it to stderr. System.err.println(getConfigurationRoot() + ": can't open, cause:"); t.printStackTrace(); } } public void close() { enabled = false; stop(); } /** * Only the subclasses have a business to know if we're enabled or not. * * @return <code>true</code> if we're enabled. */ protected boolean isEnabled() { return enabled; } public final void logMessage(LogRecord lr) { if ( !enabled ) { return; } if ( lr == null ) { // VT: FIXME: consider logging this through the normal channels (new Error( "null log record, you may want to check what's going on" )).printStackTrace(); } if ( filter == null || filter.isEnabled(lr) ) { write(lr); } } abstract protected void start(); abstract protected void stop(); abstract protected void write(LogRecord lr); } 1.1 J4/src/java/gnu/j4/core/PatternFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/PatternFilter.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/PatternFilter.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: PatternFilter.java =================================================================== package gnu.j4.core; import java.util.Enumeration; import java.util.Vector; import gnu.j4.config.Configuration; /** * Syslog facility filter based on the regular expression pattern matching. * * <p> * * This filter is much more powerful than the {@link SwitchFacilityFilter * SwitchFacilityFilter}, but it may bear more overhead. Not necessarily, * but quite probably. * * <a href="http://jakarta.apache.org/regexp/">Jakarta Regexp</a> package is * required to use this filter, see the documentation for details. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 * @version $Id: PatternFilter.java,v 1.1 2000/09/13 19:23:33 vt Exp $ */ abstract public class PatternFilter extends AbstractSyslogFilter { /** * Collection of preprocessed patterns to match. * * The patterns are specified with the keyword defined by {@link * LogConfigKeywords#SYSLOG_REX_PATTERN SYSLOG_REX_PATTERN}. */ protected Vector patternSet = new Vector(); public void configure(Configuration conf) { this.conf = (Configuration)conf.clone(); Configuration defaultConf = new Configuration(); Vector defaultPattern = new Vector(); defaultPattern.addElement(".*"); defaultPattern.addElement("-\\.DEBUG"); defaultConf.put(SYSLOG_REX_PATTERN, defaultPattern); this.conf.setDefaultConfiguration(defaultConf); try { Vector stringPatternSet = this.conf.getVector(SYSLOG_REX_PATTERN); for ( Enumeration e = stringPatternSet.elements(); e.hasMoreElements(); ) { String raw = e.nextElement().toString(); // First character is '-' (exclude) or '+' or anything else (include). boolean include = true; int patternIndex = 0; if ( raw.charAt(0) == '-' ) { include = false; patternIndex = 1; } else if ( raw.charAt(0) == '+' ) { patternIndex = 1; } String pattern = raw.substring(patternIndex, raw.length()-1); Pattern p = createPattern(include, pattern); // System.err.println("Pattern: " + sPattern); patternSet.addElement(p); } } catch ( Throwable t ) { throw new Error(t.toString()); } } /** * Find out if the combination of the log level and facility is enabled. * * @param lr Log record to analyze. * * @return true if the given combination is allowed to be written. */ public boolean isEnabled(LogRecord lr) { if ( lr == null ) { // The hell with it, I'll enable return true; } // First of all, let's glue the level and facility together String target = (lr.facility == null)?"NULL_FACILITY":lr.facility + "." + ((lr.ll == null)?"NO_LEVEL":lr.ll.toString()); // System.err.println("Search: " + target); boolean include = false; for ( Enumeration e = patternSet.elements(); e.hasMoreElements(); ) { Pattern p = (Pattern)e.nextElement(); if ( p.match(target) ) { // System.err.println("Match (" + p.include + "): "+ match.toString()); include = p.include; } } // System.err.println("Final: " + target + ": " + include ); return include; } abstract protected Pattern createPattern(boolean include, String pattern) throws Throwable; abstract protected class Pattern { boolean include = true; protected Pattern(boolean include) { this.include = include; } abstract protected boolean match(String pattern); } } 1.1 J4/src/java/gnu/j4/core/SwitchFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SwitchFilter.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SwitchFilter.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: SwitchFilter.java =================================================================== package gnu.j4.core; import gnu.j4.config.Configuration; /** * Syslog facility filter based on switching on and off individual levels * and facilities. * * This approach has certain advantages and disadvantages to it. * * <dl> * <dt>Advantages * * <dd> * * The implementation is relatively simple and performance is good. * * <dt>Disadvantages * * <dd> * * The granularity is not as good as it seems at the first glance. Imagine * you're developing a new module in the big system (having its own * facility), and you suddenly require the debug output to be switched on. * As a side effect, you have the debug output of all other facilities * switched on, and tremendous amount of log output to plow through. * * </dl> * * This module should work well in the production environment. * * <h3>Note on channels enabled by default</h3> * * Since the channel is not of an enumerated type and it's not possible to * check its value at the compile time, I'd rather bear some performance * penalties and have all the channels enabled by default rather than spend * minutes, hours and days trying to understand why particular log/debug * message doesn't appear in the log, though by all means it should have. * People make typos, nobody's perfect. Thus, if you make a typo, the log * message would still be there, and if you disable a channel and wonder why * the message is still there, you'll find out sooner ;-) * * <p> * * Walking proof: <a href="http://java.apache.org">Apache JServ</a> user * list, one of the messages on December 29 1998. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 * @version $Id: SwitchFilter.java,v 1.1 2000/09/13 19:23:33 vt Exp $ */ public class SwitchFilter extends AbstractSyslogFilter { public void configure(Configuration conf) { this.conf = conf; } /** * Find out if the combination of the log level and facility is enabled. * * @param lr Log record. * * @return <code>true</code> if the given combination is allowed to be * written. */ public boolean isEnabled(LogRecord lr) { if ( !isLevelEnabled(lr.ll) ) { return false; } if ( !isFacilityEnabled(lr.facility) ) { return false; } return true; } /** * Is the log level enabled? * <p> * * By default, all levels are enabled. * * <p> * * There is no way to find out if the log level enabled outside of this * package. This is strictly the logging system's business, nobody * else's. * * @param ll Log level to check. * * @return true if this log level is enabled by {@link #conf * configuration}. */ public boolean isLevelEnabled(LogLevel ll) { if ( ll == null ) { // logMessage( new LogRecord( Thread.currentThread(), // this,LOG_WARNING,LOG_SYSLOG, // "no log level specified for the next record",null ) ); return true; } return conf.getBoolean(SYSLOG_LEVEL + ll.toString(), true); } /** * Is the facility enabled? * <p> * * All the facilities are enabled by default. * <p> * * There is no way to find out if the log facility enabled outside of * this package. This is strictly the logging system's business, nobody * else's. * * @param channel Facility name. * @return true if the facility is enabled by {@link #conf * configuration}. */ public boolean isFacilityEnabled(String channel) { return conf.getBoolean(SYSLOG_CHANNEL + channel, true); } } 1.1 J4/src/java/gnu/j4/core/SyslogFilter.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SyslogFilter.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/SyslogFilter.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: SyslogFilter.java =================================================================== package gnu.j4.core; import gnu.j4.config.Configurable; /** * Syslog facility filter. * * Allows the log facilities to be filtered from the output. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: SyslogFilter.java,v 1.1 2000/09/13 19:23:33 vt Exp $ * @since Jukebox v4 2.0p10 */ public interface SyslogFilter extends Configurable, LogLevels, LogConfigKeywords { /** * Find out if we should pass this record down the chain. * * @param lr Log record to analyze. * * @return <code>true</code> if the filter configuration allows this * record to be passed to the log device further down the chain. */ public boolean isEnabled(LogRecord lr); } |
From: CVS B. <vt...@fr...> - 2000-09-13 00:02:50
|
User: vt Date: 00/09/12 17:02:36 Modified: src/java/gnu/j4/core Makefile.am Added: src/java/gnu/j4/core LogMultiplexor.java Log: Coming closer to changing the initialization model Revision Changes Path 1.18 +3 -2 J4/src/java/gnu/j4/core/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am?annotate=1.18&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am?rev=1.18&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/Makefile.am.diff?r1=1.18&r2=1.17&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Makefile.am 2000/08/04 23:21:46 1.17 +++ Makefile.am 2000/09/13 00:02:35 1.18 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.17 2000/08/04 23:21:46 vt Exp $ +# $Id: Makefile.am,v 1.18 2000/09/13 00:02:35 vt Exp $ EXTRA_DIST = package.html noinst_PROGRAMS = package @@ -20,7 +20,8 @@ Syslog.java \ SwitchFacilityFilter.java \ SyslogFacilityFilter.java \ - TimedOutException.java + TimedOutException.java \ + LogMultiplexor.java JAVA2_FILES = UdpSyslog.java 1.1 J4/src/java/gnu/j4/core/LogMultiplexor.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogMultiplexor.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogMultiplexor.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: LogMultiplexor.java =================================================================== package gnu.j4.core; import java.util.Enumeration; import java.util.Vector; import gnu.j4.config.Configurable; import gnu.j4.config.Configuration; /** * Single source, multiple target logging device. * * Provides an ability to log to multiple atomic logging devices. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 2000 * @version $Id: LogMultiplexor.java,v 1.1 2000/09/13 00:02:35 vt Exp $ * @since Jukebox v4 2.0.p10 * @see LogConfigKeywords */ public class LogMultiplexor implements Syslog, LogLevels, LogConfigKeywords { /** * Master configuration. */ protected Configuration conf; /** * Collection of the logging devices attached to the multiplexor. */ private Vector targets = new Vector(); /** * The log filter. * * It is not recommended to have filter installed in the multiplexor, * because the different media has different properties where it gets to * usability (for example, it is not advisable to enable all the levels * for the console log, though it's perfectly OK to do so for the file * log). * * <p> * * However, this provides an excellent quick start easily configurable * solution and/or generic debug filter. */ private SyslogFacilityFilter filter = null; public LogMultiplexor() { conf = Configuration.createChain(getConfigFileName()); configurationChanged(); } /** * Re-read the configuration and figure out what has to be updated. */ public void configurationChanged() { Vector currentNames = new Vector(); for ( Enumeration e = targets.elements(); e.hasMoreElements(); ) { currentNames.addElement(((Configurable)e.nextElement()).getConfigurationRoot()); } // Now that we've collected the names, let's figure out who to kill // and who to leave alone. The configuration has been changed by // now. } /** * Add the logging device. * * <p> * * Once the device is added, the subsequent log records will be * submitted to this device as well as other devices already registered. * * <p> * * This method is to be used to add the devices instantiated by the * independent third party. The devices being added will not be * reconfigured. * * @param syslog The device instance */ public void add(Syslog syslog) { targets.addElement(syslog); } public void logMessage(LogRecord message) { if ( filter == null || filter.isEnabled(message.ll, message.facility) ) { for ( Enumeration e = targets.elements(); e.hasMoreElements(); ) { ((Syslog)e.nextElement()).logMessage(message); } } } /** * Return the <code>basename(1)</code> of the log configuration file. * * @return {@link LogConfigKeywords#LOG_CF_FILE LogConfigKeywords#LOG_CF_FILE}. */ protected String getConfigFileName() { return LOG_CF_FILE; } } |
From: CVS B. <vt...@fr...> - 2000-09-13 00:02:46
|
User: vt Date: 00/09/12 17:02:35 Modified: src/java/gnu/j4/config Makefile.am Added: src/java/gnu/j4/config Configurable.java Log: Coming closer to changing the initialization model Revision Changes Path 1.10 +2 -1 J4/src/java/gnu/j4/config/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?annotate=1.10&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am.diff?r1=1.10&r2=1.9&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Makefile.am 2000/08/24 20:35:49 1.9 +++ Makefile.am 2000/09/13 00:02:35 1.10 @@ -1,6 +1,7 @@ -# $Id: Makefile.am,v 1.9 2000/08/24 20:35:49 vt Exp $ +# $Id: Makefile.am,v 1.10 2000/09/13 00:02:35 vt Exp $ BASE_FILES = ConfigReader.java \ + Configurable.java \ Configuration.java \ PropertiesReader.java 1.1 J4/src/java/gnu/j4/config/Configurable.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configurable.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configurable.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: Configurable.java =================================================================== package gnu.j4.config; /** * General definition of a configurable object. * * <p> * * Generally speaking, there's one serious problem with the configuration * per se: the chicken and egg problem, or the bootstrap sequence. * * <p> * * For example, every configurable object has to be able to tell what * exactly part of the original configuration is responsible for its * configuration, and it is not easy to determine. Thus, in order to * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998-2000 * * @version $Id: Configurable.java,v 1.1 2000/09/13 00:02:35 vt Exp $ */ public interface Configurable { /** * Configure the object. * * {@link #getConfigurationRoot getConfigurationRoot()} must not return * <code>null</code> at the time this method is called. * * @exception IllegalStateException if it turns out {@link * #getConfigurationRoot getConfigurationRoot()} did return null. We * cannot proceed without knowing where our configuration is. */ public void configure(Configuration conf); /** * Get the path to the root configuration element. * * @return Dot delimited string defining the way from the configuration * top to the configuration element defining the configuration for this * object. */ public String getConfigurationRoot(); } |
From: CVS B. <vt...@fr...> - 2000-08-31 23:42:41
|
User: vt Date: 00/08/31 16:42:38 Modified: src/java/gnu/j4/service PassiveService.java Log: Oops, name offset eliminated. Revision Changes Path 1.16 +3 -3 J4/src/java/gnu/j4/service/PassiveService.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java?annotate=1.16&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java?rev=1.16&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java.diff?r1=1.16&r2=1.15&cvsroot=jukebox4 ----------------------------------- Index: PassiveService.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/PassiveService.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- PassiveService.java 2000/08/28 18:26:18 1.15 +++ PassiveService.java 2000/08/31 23:42:38 1.16 @@ -50,7 +50,7 @@ * target="_top">$500 million mistake</a>. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 - * @version $Id: PassiveService.java,v 1.15 2000/08/28 18:26:18 vt Exp $ + * @version $Id: PassiveService.java,v 1.16 2000/08/31 23:42:38 vt Exp $ * @see ActiveService */ public abstract class PassiveService extends LogAware implements RunnableService { @@ -606,7 +606,7 @@ PassiveWrapper pw = new PassiveWrapper(new StartupWrapper(this), semUp); - core = tf.allocate(tGroup, pw, pw.target.getClass().getName()); + core = tf.allocate(tGroup, pw, getClass().getName()); core.start(); } @@ -650,7 +650,7 @@ PassiveWrapper pw = new PassiveWrapper(new ShutdownWrapper(this), semDown); - core = tf.allocate(tGroup, pw, pw.target.getClass().getName()); + core = tf.allocate(tGroup, pw, getClass().getName()); core.start(); } |
From: CVS B. <vt...@fr...> - 2000-08-31 07:29:01
|
User: vt Date: 00/08/31 00:28:57 Modified: src/java/gnu/j4/core FileSyslog.java LogConfigKeywords.java Log: Added the log rotation. So far, it's just size based, but enough for the practical purposes. Revision Changes Path 1.4 +244 -19 J4/src/java/gnu/j4/core/FileSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/FileSyslog.java?annotate=1.4&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/FileSyslog.java?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/FileSyslog.java.diff?r1=1.4&r2=1.3&cvsroot=jukebox4 ----------------------------------- Index: FileSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/FileSyslog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FileSyslog.java 2000/07/24 06:42:08 1.3 +++ FileSyslog.java 2000/08/31 07:28:56 1.4 @@ -1,8 +1,11 @@ package gnu.j4.core; +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; /** * Syslog with the file output. @@ -19,12 +22,17 @@ * The {@link #write write()} method looks really weird because it's being * called before the actual construction of the object is completed ;-) * - * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998 - * @version $Id: FileSyslog.java,v 1.3 2000/07/24 06:42:08 vt Exp $ + * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998-2000 + * @version $Id: FileSyslog.java,v 1.4 2000/08/31 07:28:56 vt Exp $ */ public class FileSyslog extends BasicSyslog implements LogLevels, LogConfigKeywords { /** + * File to write the log to. + */ + protected File target; + + /** * Stream to write to. */ protected PrintWriter out; @@ -35,6 +43,39 @@ protected SimpleQueue deferred; /** + * Maximum size allowed for the output file, in bytes. + * + * Zero value means no limits (no rotation, either). + */ + protected long maxSize; + + /** + * Current size of the log file. + * + * Actually, the sum of the lenghts of all the records logged since this + * counter was reset (on instantiation or rotation). Gets adjusted on + * instantiation if the file already exists. + */ + protected long currentSize = 0; + + /** + * Maximum age allowed for the output file, in seconds. + * + * Zero value means no limits (no rotation, either). + */ + protected long maxAge; + + /** + * String that defines the name of the rotated file. + */ + protected String suffixFormat; + + /** + * Used to compose the suffix of the rotated file. + */ + protected SimpleDateFormat suffixFormatter; + + /** * Create the instance. * * Get the {@link LogConfigKeywords#SYSLOG_FILE file name} from the @@ -44,35 +85,146 @@ * the file specified in the configuration. */ public FileSyslog() throws InstantiationException { + super(); - - init(conf.getString(SYSLOG_FILE)); - + init(conf.getString(SYSLOG_FILE_NAME), + conf.getLong(SYSLOG_FILE_MAXSIZE, 0), + conf.getLong(SYSLOG_FILE_MAXAGE, 0), + conf.getString(SYSLOG_FILE_SUFFIX, SYSLOG_FILE_SUFFIX_DEFAULT)); } /** * Create the instance writing to the specified log file. + * + * @param outputFileName Name of the file to write the log to. + * + * @param maxSize Maximum allowed file size, in bytes, before the log + * has to be rotated. Zero value means no size rotation. * - * @param outputFileName File to write the log to. + * @param maxAge Maximum allowed time, in seconds, before the log has to + * be rotated. Zero value means no time rotation. * + * @param suffixFormat How the suffix is going to look like. + * * @exception InstantiationException if it is not possible to write to * the file specified in the configuration. */ - public FileSyslog(String outputFileName) throws InstantiationException { + public FileSyslog(String outputFileName, long maxSize, long maxAge, String suffixFormat) throws InstantiationException { super(); - init(outputFileName); + init(outputFileName, maxSize, maxAge, suffixFormat); } /** - * Actually open the file. + * Actually open the file and configure the rotation, if required. + * + * @param outputFileName Name of the file to write the log to. + * + * @param maxSize Maximum allowed file size, in bytes, before the log + * has to be rotated. Zero value means no size rotation. + * + * @param maxAge Maximum allowed time, in seconds, before the log has to + * be rotated. Zero value means no time rotation. + * + * @param suffixFormat How the suffix is going to look like. + * + * @exception InstantiationException if it is not possible to write to + * the file specified in the configuration. */ - private void init(String outputFileName) throws InstantiationException { + private void init(String outputFileName, long maxSize, long maxAge, String suffixFormat) throws InstantiationException { + + this.maxSize = maxSize; + this.maxAge = maxAge; + this.suffixFormat = suffixFormat; + suffixFormatter = new SimpleDateFormat(suffixFormat); try { - out = new PrintWriter(new FileOutputStream(outputFileName)); + // Check if the formatter is OK + + suffixFormatter.format(new Date(System.currentTimeMillis())); + + } catch ( Throwable t ) { + + // Shit, they've screwed up! + + String message = SYSLOG_FILE_SUFFIX + + " (" + + conf.getString(SYSLOG_FILE_SUFFIX) + + ") is invalid (" + + t.getMessage() + + "), using default (" + + SYSLOG_FILE_SUFFIX_DEFAULT + + ")"; + + Logger.log(Thread.currentThread(), this, LOG_WARNING, Logger.LOG_LOGGER, message, null); + + // We don't have a right to screw up on this one! + + this.suffixFormat = SYSLOG_FILE_SUFFIX_DEFAULT; + suffixFormatter = new SimpleDateFormat(this.suffixFormat); + } + + if ( maxSize != 0 ) { + + logMessage(new LogRecord(Thread.currentThread(), + this, + LOG_NOTICE, + Logger.LOG_LOGGER, + "The file will be rotated if exceeds " + + maxSize + + " bytes, suffix is '" + + suffixFormat + + "'", + null)); + } + try { + + // This variable will be set to true if the old log exists and + // has to be appended to. + + boolean append = false; + + // First of all, let's see if we have to rotate it + + target = new File(outputFileName); + + if ( target.exists() ) { + + // OK, we do have to do something about it. We wouldn't + // rotate the log based on time, though. + + if ( maxSize != 0 ) { + + if ( target.length() >= maxSize ) { + + // OK, have to rotate... + + doRotate(); + + } else { + + currentSize += target.length(); + append = true; + + } + + } else { + + + // Well, since it does exist and we didn't have to + // rotate it, let's append, then + + append = true; + } + + } + + // OK, by now it's supposed to be rotated already. + + out = new PrintWriter(new FileOutputStream(target.toString(), append)); + } catch ( IOException ioex ) { Logger.logTo(null); @@ -94,26 +246,99 @@ if ( out == null ) { - // This bizarre situation (with both 'out' and 'deferred) - // happens because this method is called before the actual - // construction is being done, not because I'm stupid and forgot - // to create the objects in the constructor or in the + // VT: NOTE: This bizarre situation (with both 'out' and + // 'deferred') happens because this method is called before the + // actual construction is being done, not because I'm stupid and + // forgot to create the objects in the constructor or in the // declaration. if ( deferred == null ) { deferred = new SimpleQueue(); } + deferred.put(message); } else { - while ( !deferred.isEmpty() ) { - out.println(deferred.get().toString()); + synchronized ( this ) { + while ( !deferred.isEmpty() ) { + + String deferredMessage = deferred.get().toString(); + + out.println(deferredMessage); + + currentSize += deferredMessage.length(); + } + + out.println(message); + out.flush(); + + currentSize += message.length(); + + // We've allowed some slack to write the deferred messages, but + // it shouldn't matter too much since the only case it exists at + // all is at the startup. + + // Now it's time to check if we have to rotate the log. + + if ( maxSize != 0 && currentSize >= maxSize ) { + + rotate(); + } } + } + } + + /** + * Rotate the output file. + * + * This is a wrapper for the {@link #doRotate actual rotation call}. It + * closes the output stream before rotating and reopend it after. + */ + private void rotate() { + + long start = System.currentTimeMillis(); + + // No need to flush, we've just done it + + out.close(); + doRotate(); + + try { + + init(target.toString(), maxSize, maxAge, suffixFormat); - out.println(message); - out.flush(); + } catch ( Throwable t ) { + + System.err.println("This is quite unlikely and bizarre, don't know how to handle:"); + t.printStackTrace(); } + + logMessage(new LogRecord(Thread.currentThread(), + this, + LOG_NOTICE, + Logger.LOG_LOGGER, + "Rotation complete in " + + (System.currentTimeMillis()-start) + + "ms", + null)); + } + + /** + * Rotate the output file. + * + * <strong>IMPORTANT:</strong> the output file must not be open, + * otherwise we have a resource leak (on UNIX) or sharing violation (on + * Windows). + */ + private void doRotate() { + + File rotated = new File(target.toString() + + "." + + suffixFormatter.format(new Date(System.currentTimeMillis()))); + + target.renameTo(rotated); + currentSize = 0; } } 1.10 +27 -3 J4/src/java/gnu/j4/core/LogConfigKeywords.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogConfigKeywords.java?annotate=1.10&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogConfigKeywords.java?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/LogConfigKeywords.java.diff?r1=1.10&r2=1.9&cvsroot=jukebox4 ----------------------------------- Index: LogConfigKeywords.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/LogConfigKeywords.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- LogConfigKeywords.java 1999/06/29 04:35:34 1.9 +++ LogConfigKeywords.java 2000/08/31 07:28:56 1.10 @@ -4,8 +4,8 @@ * Basic set of string constants used in the log system configuration. * <p> * See the source code for exact values. - * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998 - * @version $Id: LogConfigKeywords.java,v 1.9 1999/06/29 04:35:34 vt Exp $ + * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1998-2000 + * @version $Id: LogConfigKeywords.java,v 1.10 2000/08/31 07:28:56 vt Exp $ */ public interface LogConfigKeywords { /** @@ -121,5 +121,29 @@ * Configuration keyword to retrieve the file name for {@link FileSyslog * FileSyslog}. */ - public static final String SYSLOG_FILE = "syslog.file"; + public static final String SYSLOG_FILE_NAME = "syslog.file.name"; + + /** + * Configuration keyword to retrieve the maximum size allowed for the + * {@link FileSyslog FileSyslog} output file. + */ + public static final String SYSLOG_FILE_MAXSIZE = "syslog.file.maxsize"; + + /** + * Configuration keyword to retrieve the maximum age allowed for the + * {@link FileSyslog FileSyslog} output file. + */ + public static final String SYSLOG_FILE_MAXAGE = "syslog.file.maxage"; + + /** + * Configuration keyword to retrieve the rotation suffix for {@link + * FileSyslog FileSyslog} output file. It has to be formatted according + * to the requirements of <code>java.text.SimpleDateFormat</code> class. + */ + public static final String SYSLOG_FILE_SUFFIX = "syslog.file.suffix"; + + /** + * Default {@link FileSyslog syslog file} rotation suffix format. + */ + public static final String SYSLOG_FILE_SUFFIX_DEFAULT = "yyyy.MM.dd-hh:mm:ss"; } |
From: CVS B. <vt...@fr...> - 2000-08-28 18:26:14
|
User: vt Date: 00/08/28 11:26:19 Modified: src/java/gnu/j4/service ActiveService.java Makefile.am PassiveService.java Added: src/java/gnu/j4/service DefaultThreadFactory.java PooledThreadFactory.java ThreadFactory.java Log: Introduced the thread pooling. Implementation is incomplete, currently it uses just a mockup of a thread pool. Revision Changes Path 1.6 +8 -5 J4/src/java/gnu/j4/service/ActiveService.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ActiveService.java?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ActiveService.java?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ActiveService.java.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: ActiveService.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/ActiveService.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ActiveService.java 2000/03/03 04:20:22 1.5 +++ ActiveService.java 2000/08/28 18:26:18 1.6 @@ -6,7 +6,7 @@ * then shuts down (observing some post-conditions at shutdown). * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 - * @version $Id: ActiveService.java,v 1.5 2000/03/03 04:20:22 vt Exp $ + * @version $Id: ActiveService.java,v 1.6 2000/08/28 18:26:18 vt Exp $ * @see PassiveService */ public abstract class ActiveService extends PassiveService { @@ -26,7 +26,10 @@ abstract protected void execute() throws InterruptedException, Throwable; protected void startCore() { - core = new ActiveWrapper(tGroup,this); + + ActiveWrapper aw = new ActiveWrapper(this); + + core = tf.allocate(tGroup, aw, getClass().getName()); core.start(); } @@ -49,12 +52,12 @@ } } - protected class ActiveWrapper extends Thread { + protected class ActiveWrapper implements Runnable { protected ActiveService target; + + protected ActiveWrapper(ActiveService target) { - protected ActiveWrapper(ThreadGroup tGroup,ActiveService target) { - super(tGroup,target.getClass().getName()); this.target = target; } 1.11 +5 -2 J4/src/java/gnu/j4/service/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/Makefile.am?annotate=1.11&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/Makefile.am?rev=1.11&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/Makefile.am.diff?r1=1.11&r2=1.10&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 2000/07/06 10:47:09 1.10 +++ Makefile.am 2000/08/28 18:26:18 1.11 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.10 2000/07/06 10:47:09 vt Exp $ +# $Id: Makefile.am,v 1.11 2000/08/28 18:26:18 vt Exp $ EXTRA_DIST = package.html SUBDIRS = net @@ -12,7 +12,10 @@ ResourcePool.java \ RunnableService.java \ Service.java \ - ServiceUnavailableException.java + ServiceUnavailableException.java \ + ThreadFactory.java \ + DefaultThreadFactory.java \ + PooledThreadFactory.java JMX_FILES = MBeanServerWrapper.java 1.15 +12 -9 J4/src/java/gnu/j4/service/PassiveService.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java?annotate=1.15&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java?rev=1.15&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PassiveService.java.diff?r1=1.15&r2=1.14&cvsroot=jukebox4 ----------------------------------- Index: PassiveService.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/PassiveService.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- PassiveService.java 2000/07/19 21:31:55 1.14 +++ PassiveService.java 2000/08/28 18:26:18 1.15 @@ -49,8 +49,8 @@ * href="http://www.eiffel.com/doc/manuals/technology/contract/ariane/index.html" * target="_top">$500 million mistake</a>. * - * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: PassiveService.java,v 1.14 2000/07/19 21:31:55 vt Exp $ + * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 + * @version $Id: PassiveService.java,v 1.15 2000/08/28 18:26:18 vt Exp $ * @see ActiveService */ public abstract class PassiveService extends LogAware implements RunnableService { @@ -60,6 +60,8 @@ */ public final static String CH_WRAPPER = "service/wrapper"; + protected ThreadFactory tf = new DefaultThreadFactory(); + /** * Execute the startup sequence. * @@ -602,7 +604,9 @@ */ protected void startCore() { - core = new PassiveWrapper(tGroup, new StartupWrapper(this), semUp); + PassiveWrapper pw = new PassiveWrapper(new StartupWrapper(this), semUp); + + core = tf.allocate(tGroup, pw, pw.target.getClass().getName()); core.start(); } @@ -644,7 +648,9 @@ */ protected void stopCore() { - core = new PassiveWrapper(tGroup, new ShutdownWrapper(this), semDown); + PassiveWrapper pw = new PassiveWrapper(new ShutdownWrapper(this), semDown); + + core = tf.allocate(tGroup, pw, pw.target.getClass().getName()); core.start(); } @@ -667,7 +673,7 @@ * * @see PassiveService.MethodWrapper */ - protected class PassiveWrapper extends Thread { + protected class PassiveWrapper implements Runnable { /** * Call target. @@ -682,17 +688,14 @@ /** * Create a new wrapper. * - * @param tGroup ThreadGroup to belong to - * * @param target Method wrapper providing the invocation target and the proper method. * * @param sem Event semaphore to trigger with the result of the method call. * * @see PassiveService#tGroup */ - PassiveWrapper(ThreadGroup tGroup, MethodWrapper target, EventSemaphore sem) { + PassiveWrapper(MethodWrapper target, EventSemaphore sem) { - super(tGroup, target.target.getClass().getName()); this.target = target; this.sem = sem; } 1.1 J4/src/java/gnu/j4/service/DefaultThreadFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/DefaultThreadFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/DefaultThreadFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: DefaultThreadFactory.java =================================================================== package gnu.j4.service; /** * Default thread factory. * * Just creates a new thread object every time a thread is requested. This * is done to ensure that the thread creation logic is fine. No performance * improvements are achieved, on the contrary, it introduces a method call * overhead on every thread creation request. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: DefaultThreadFactory.java,v 1.1 2000/08/28 18:26:18 vt Exp $ */ public class DefaultThreadFactory extends ThreadFactory { /** * Log facility to use. */ public static final String CH_DTF = "ThreadFactory/default"; /** * Obtain a thread reference. * * The <code>Thread</code> object returned by this method must be in a * state that allows invoking <code>start()</code> method on it. * * @param tg Thread group to belong to. This parameter is required to * avoid the security implications in case the default thread group is * not the one we want. * * @param r The runnable object for the newly allocated thread to run. * * @param name Name for the thread to be returned. * * @return Reference to a thread object. */ public Thread allocate(ThreadGroup tg, Runnable r, String name) { complain(LOG_DEBUG, CH_DTF, "Allocated " + tg.getName() + "/" + name); return new Thread(tg, r, name); } /** * Return a thread reference to the pool. * * @param t Thread object to make available to the pool again. */ public void release(Thread t) { complain(LOG_DEBUG, CH_DTF, "Freed " + t.getThreadGroup().getName() + "/" + t.getName()); } } 1.1 J4/src/java/gnu/j4/service/PooledThreadFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PooledThreadFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/PooledThreadFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: PooledThreadFactory.java =================================================================== package gnu.j4.service; /** * Pooled thread factory. * * Instead of just returning a new thread like a {@link DefaultThreadFactory * DefaultThreadFactory} does, this object tries to pool and reuse the * threads. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: PooledThreadFactory.java,v 1.1 2000/08/28 18:26:19 vt Exp $ */ public class PooledThreadFactory extends ThreadFactory { /** * Log facility to use. */ public static final String CH_PTF = "ThreadFactory/pooled"; /** * Obtain a thread reference. * * The <code>Thread</code> object returned by this method must be in a * state that allows invoking <code>start()</code> method on it. * * @param tg Thread group to belong to. This parameter is required to * avoid the security implications in case the default thread group is * not the one we want. * * @param r The runnable object for the newly allocated thread to run. * * @param name Name for the thread to be returned. * * @return Reference to a thread object. */ public Thread allocate(ThreadGroup tg, Runnable r, String name) { complain(LOG_DEBUG, CH_PTF, "Allocated " + tg.getName() + "/" + name); throw new Error("Not Implemented"); } /** * Return a thread reference to the pool. * * @param t Thread object to make available to the pool again. */ public void release(Thread t) { complain(LOG_DEBUG, CH_PTF, "Freed " + t.getThreadGroup().getName() + "/" + t.getName()); throw new Error("Not Implemented"); } } 1.1 J4/src/java/gnu/j4/service/ThreadFactory.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ThreadFactory.java?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ThreadFactory.java?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: ThreadFactory.java =================================================================== package gnu.j4.service; import gnu.j4.core.LogAware; /** * An abstract thread factory. * * Using a thread factory instead of a <code>Thread</code> constructor * allows to have a fine-grained control over a thread creation and * destruction. Keeping in mind that there are issues with the thread * garbage collection, this may improve the performance quite a bit. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-2000 * @version $Id: ThreadFactory.java,v 1.1 2000/08/28 18:26:19 vt Exp $ */ abstract public class ThreadFactory extends LogAware { /** * Obtain a thread reference. * * The <code>Thread</code> object returned by this method must be in a * state that allows invoking <code>start()</code> method on it. * * @param tg Thread group to belong to. This parameter is required to * avoid the security implications in case the default thread group is * not the one we want. * * @param r The runnable object for the newly allocated thread to run. * * @param name Name for the thread to be returned. * * @return Reference to a thread object. */ abstract public Thread allocate(ThreadGroup tg, Runnable r, String name); /** * Return a thread reference to the pool. * * @param t Thread object to make available to the pool again. */ abstract public void release(Thread t); } |
From: CVS B. <vt...@fr...> - 2000-08-24 21:22:32
|
User: vt Date: 00/08/24 14:22:35 Modified: docs/apidocs index-template.html Log: Cosmetic changes Revision Changes Path 1.9 +1 -1 J4/docs/apidocs/index-template.html CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/docs/apidocs/index-template.html.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: index-template.html =================================================================== RCS file: /usr/local/cvs/J4/docs/apidocs/index-template.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- index-template.html 2000/08/24 20:35:48 1.8 +++ index-template.html 2000/08/24 21:22:35 1.9 @@ -2,7 +2,7 @@ <!--NewPage--> <HTML> <HEAD> -<!-- Generated by javadoc on Sun Aug 06 22:55:54 MST 2000--> +<!-- Generated by javadoc on Thu Aug 24 13:45:12 MST 2000--> <TITLE> Generated Documentation (Untitled) </TITLE> |
From: CVS B. <vt...@fr...> - 2000-08-24 21:22:22
|
User: vt Date: 00/08/24 14:22:36 Added: src/java/gnu/j4/net/ldap .cvsignore Log: Cosmetic changes Revision Changes Path 1.1 J4/src/java/gnu/j4/net/ldap/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/ldap/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/net/ldap/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class .deps |
From: CVS B. <vt...@fr...> - 2000-08-24 21:22:19
|
User: vt Date: 00/08/24 14:22:36 Added: src/java/gnu/j4/ejb/examples .cvsignore Log: Cosmetic changes Revision Changes Path 1.1 J4/src/java/gnu/j4/ejb/examples/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/ejb/examples/.cvsignore?annotate=1.1&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/ejb/examples/.cvsignore?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== Makefile Makefile.in *.class .deps |
From: CVS B. <vt...@fr...> - 2000-08-24 20:40:52
|
User: vt Date: 00/08/24 13:41:09 Modified: examples Makefile.am Log: Fixed typo Revision Changes Path 1.10 +2 -2 J4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?annotate=1.10&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am.diff?r1=1.10&r2=1.9&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/examples/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Makefile.am 2000/08/24 20:35:49 1.9 +++ Makefile.am 2000/08/24 20:41:09 1.10 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.9 2000/08/24 20:35:49 vt Exp $ +# $Id: Makefile.am,v 1.10 2000/08/24 20:41:09 vt Exp $ bin_PROGRAMS = exampleLogTest \ exampleLruCacheTest \ @@ -24,7 +24,7 @@ exampleSimpleServiceTest_SOURCES = exampleSimpleServiceTest exampleTelnetTest_SOURCES = exampleTelnetTest exampleRWLockTest_SOURCES = exampleRWLockTest -exampleXmlConfigurationTest_SOURCES = exampleXmlConfigutrationTest +exampleXmlConfigurationTest_SOURCES = exampleXmlConfigurationTest RM = @RM@ |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:35
|
User: vt Date: 00/08/24 13:35:49 Modified: examples .cvsignore Makefile.am Added: examples exampleXmlConfigurationTest.in Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.9 +1 -0 J4/examples/.cvsignore CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/.cvsignore?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/.cvsignore?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/.cvsignore.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: .cvsignore =================================================================== RCS file: /usr/local/cvs/J4/examples/.cvsignore,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- .cvsignore 2000/06/13 23:36:36 1.8 +++ .cvsignore 2000/08/24 20:35:49 1.9 @@ -9,4 +9,5 @@ exampleSemaphoreGroupTest exampleSimpleServiceTest exampleTelnetTest +exampleXmlConfigurationTest index.html 1.9 +6 -2 J4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/Makefile.am.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/examples/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Makefile.am 2000/07/06 10:47:00 1.8 +++ Makefile.am 2000/08/24 20:35:49 1.9 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.8 2000/07/06 10:47:00 vt Exp $ +# $Id: Makefile.am,v 1.9 2000/08/24 20:35:49 vt Exp $ bin_PROGRAMS = exampleLogTest \ exampleLruCacheTest \ @@ -8,7 +8,8 @@ exampleSemaphoreGroupTest \ exampleConfigTest \ exampleSimpleServiceTest \ - exampleTelnetTest + exampleTelnetTest \ + exampleXmlConfigurationTest bin_DATA = index.html @@ -23,6 +24,7 @@ exampleSimpleServiceTest_SOURCES = exampleSimpleServiceTest exampleTelnetTest_SOURCES = exampleTelnetTest exampleRWLockTest_SOURCES = exampleRWLockTest +exampleXmlConfigurationTest_SOURCES = exampleXmlConfigutrationTest RM = @RM@ @@ -47,3 +49,5 @@ exampleTelnetTest: exampleRWLockTest: + +exampleXmlConfigurationTest: 1.2 +11 -0 J4/examples/exampleXmlConfigurationTest.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/exampleXmlConfigurationTest.in?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/exampleXmlConfigurationTest.in?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/examples/exampleXmlConfigurationTest.in.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:34
|
User: vt Date: 00/08/24 13:35:50 Modified: src/java/gnu/j4/service ApplicationWrapper.java Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.12 +5 -1 J4/src/java/gnu/j4/service/ApplicationWrapper.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ApplicationWrapper.java?annotate=1.12&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ApplicationWrapper.java?rev=1.12&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/service/ApplicationWrapper.java.diff?r1=1.12&r2=1.11&cvsroot=jukebox4 ----------------------------------- Index: ApplicationWrapper.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/service/ApplicationWrapper.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ApplicationWrapper.java 2000/06/06 18:46:26 1.11 +++ ApplicationWrapper.java 2000/08/24 20:35:50 1.12 @@ -118,7 +118,7 @@ * * @since Jukebox v2 * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1999 - * @version $Id: ApplicationWrapper.java,v 1.11 2000/06/06 18:46:26 vt Exp $ + * @version $Id: ApplicationWrapper.java,v 1.12 2000/08/24 20:35:50 vt Exp $ */ public final class ApplicationWrapper extends LogAware { @@ -214,6 +214,10 @@ ApplicationWrapper w = new ApplicationWrapper(argv); exitCode = w.execute(); + } catch ( Throwable t ) { + + t.printStackTrace(); + } finally { System.gc(); |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:34
|
User: vt Date: 00/08/24 13:35:51 Modified: src/scripts j4wrapper.in Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.6 +6 -2 J4/src/scripts/j4wrapper.in CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in?annotate=1.6&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in?rev=1.6&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/scripts/j4wrapper.in.diff?r1=1.6&r2=1.5&cvsroot=jukebox4 ----------------------------------- Index: j4wrapper.in =================================================================== RCS file: /usr/local/cvs/J4/src/scripts/j4wrapper.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- j4wrapper.in 2000/06/06 18:46:27 1.5 +++ j4wrapper.in 2000/08/24 20:35:51 1.6 @@ -1,6 +1,6 @@ #! /bin/sh # -# $Id: j4wrapper.in,v 1.5 2000/06/06 18:46:27 vt Exp $ +# $Id: j4wrapper.in,v 1.6 2000/08/24 20:35:51 vt Exp $ # # This script is used to run the classes extending the # gnu.j4.service.RunnableService. Please see the documentation - the wrapper @@ -8,7 +8,11 @@ # # J4WRAPPER environment variable -TARGET_CLASSPATH=@prefix@/lib/@PACKAGE@.jar:@JMX_CLASSES@:@JMXTOOLS_CLASSES@:${CLASSPATH} +TARGET_CLASSPATH=@prefix@/lib/@PACKAGE@.jar:\ +@JMX_CLASSES@:\ +@JMXTOOLS_CLASSES@:\ +@XERCES_CLASSES@:\ +${CLASSPATH} JAVA_OPT="@JAVA_OPT@" |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:33
|
User: vt Date: 00/08/24 13:35:50 Modified: src/java/gnu/j4/examples Makefile.am Added: src/java/gnu/j4/examples XmlConfigTest.java Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.23 +12 -9 J4/src/java/gnu/j4/examples/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?annotate=1.23&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am?rev=1.23&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Makefile.am.diff?r1=1.23&r2=1.22&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Makefile.am 2000/07/25 09:22:17 1.22 +++ Makefile.am 2000/08/24 20:35:50 1.23 @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.22 2000/07/25 09:22:17 vt Exp $ +# $Id: Makefile.am,v 1.23 2000/08/24 20:35:50 vt Exp $ noinst_PROGRAMS = package @@ -24,28 +24,31 @@ JAVA2_FILES = LogTest.java \ RWLockTest.java +XERCES_FILES = XmlConfigTest.java + EJB_FILES = EXTRA_DIST = package.html ${JAVA2_FILES} ${EJB_FILES} if EJB - -if JAVA2 -package_SOURCES = ${BASE_FILES} ${JAVA2_FILES} ${EJB_FILES} +EJB_SUBSET = ${EJB_FILES} else -package_SOURCES = ${BASE_FILES} ${EJB_FILES} +EJB_SUBSET = endif -else - if JAVA2 -package_SOURCES = ${BASE_FILES} ${JAVA2_FILES} +JAVA2_SUBSET = ${JAVA2_FILES} else -package_SOURCES = ${BASE_FILES} +JAVA2_SUBSET = endif +if XERCES +XERCES_SUBSET = ${XERCES_FILES} +else +XERCES_SUBSET endif +package_SOURCES = ${BASE_FILES} ${JAVA2_SUBSET} ${EJB_SUBSET} ${XERCES_SUBSET} ECHO = @ECHO@ JAVACX = @JAVACX@ 1.2 +87 -0 J4/src/java/gnu/j4/examples/XmlConfigTest.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/XmlConfigTest.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/XmlConfigTest.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/XmlConfigTest.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:33
|
User: vt Date: 00/08/24 13:35:50 Modified: src/java/gnu/j4/core BasicSyslog.java Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.16 +42 -1 J4/src/java/gnu/j4/core/BasicSyslog.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java?annotate=1.16&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java?rev=1.16&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/core/BasicSyslog.java.diff?r1=1.16&r2=1.15&cvsroot=jukebox4 ----------------------------------- Index: BasicSyslog.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/core/BasicSyslog.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- BasicSyslog.java 2000/07/17 02:14:25 1.15 +++ BasicSyslog.java 2000/08/24 20:35:50 1.16 @@ -43,7 +43,7 @@ * something less complicated, at least for the production versions. * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: BasicSyslog.java,v 1.15 2000/07/17 02:14:25 vt Exp $ + * @version $Id: BasicSyslog.java,v 1.16 2000/08/24 20:35:50 vt Exp $ * @since Jukebox v4 * @see LogConfigKeywords */ @@ -117,6 +117,47 @@ public void configurationChanged() { dateFormatter = new SimpleDateFormat(conf.getString(DATEFORMAT_CF, DEFAULT_DATEFORMAT)); + + // We know it's possible to make typos in the configuration. To + // ensure the date format is right, I'll try to format the date + // here, because this is the least expensive place to do it. + + try { + + dateFormatter.format(new Date(System.currentTimeMillis())); + + } catch ( Throwable t ) { + + // OK, we're not OK. + // + // Let's just get the default format and pray it works fine. + // Otherwise, we're screwed. + + dateFormatter = new SimpleDateFormat(DEFAULT_DATEFORMAT); + + // And don't forget to complain. The logging system may be + // inoperable at this point, so let's take care of that as well. + + String message = "syslog.timestamp.format (" + + conf.getString(DATEFORMAT_CF) + + ") is invalid (" + + t.getMessage() + + "), using default (" + + DEFAULT_DATEFORMAT + + ")"; + try { + + logMessage(new LogRecord(Thread.currentThread(), + this, LOG_WARNING, Logger.LOG_LOGGER, + message, + null)); + + } catch ( NullPointerException npex ) { + + System.err.println("WARNING: " + message); + } + + } Class filterClass = null; |
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:33
|
User: vt Date: 00/08/24 13:35:50 Modified: src/java/gnu/j4/config Configuration.java Makefile.am Added: src/java/gnu/j4/config XmlConfiguration.java Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.31 +33 -20 J4/src/java/gnu/j4/config/Configuration.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?annotate=1.31&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?rev=1.31&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java.diff?r1=1.31&r2=1.30&cvsroot=jukebox4 ----------------------------------- Index: Configuration.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Configuration.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Configuration.java 2000/07/25 17:42:28 1.30 +++ Configuration.java 2000/08/24 20:35:49 1.31 @@ -25,7 +25,7 @@ * target=_top>Java-Apache Project</a> in general and code written by <a * href="mailto:st...@ap...">Stefano Mazzocchi</a> in particular. * - * @version $Id: Configuration.java,v 1.30 2000/07/25 17:42:28 vt Exp $ + * @version $Id: Configuration.java,v 1.31 2000/08/24 20:35:49 vt Exp $ */ public class Configuration extends Hashtable { @@ -519,45 +519,58 @@ * If there's already existing value[s], the value is added into the * sequence of values. * + * <p> + * + * <strong>NOTE:</strong> it is not possible to distinguish between the + * <code>Vector</code> that is a value itself and the + * <code>Vector</code> that is a collection of other values. Caveat + * emptor. + * * @param key The key. * * @param value The value. - * - * @exception IllegalArgumentException if the argument is neither - * <code>String</code> nor <code>Vector</code>. */ - public void put(String key, String value) { + public void put(String key, Object value) { + Object found = super.get(key); if ( found == null ) { + + // OK, we don't have to fiddle with the sequence + super.put(key, value); return; + } if ( found instanceof Vector ) { + + // OK, there's existing sequence already. + Vector vFound = (Vector)found; if ( vFound.indexOf(value) == -1 ) { + vFound.addElement(value); + return; + + } else { + + // Oh well, it's already there, I'm not going to add a + // duplicate } - return; - } - - if ( found instanceof String ) { - String first = (String)found; - super.remove(key); - Vector set = new Vector(); - set.addElement(first); - set.addElement(value); - super.put(key, set); - return; } - throw new IllegalArgumentException(key - + " maps to " - + found.getClass().getName() - + ", String/Vector expected"); + // Now, we know for sure that some object is already set to be the + // configuration value, and it's not a collection (well, Vector), so + // we have to create a collection and add new value to it. + + super.remove(key); + Vector set = new Vector(); + set.addElement(found); + set.addElement(value); + super.put(key, set); } /** 1.9 +12 -7 J4/src/java/gnu/j4/config/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Makefile.am 2000/07/06 10:47:03 1.8 +++ Makefile.am 2000/08/24 20:35:49 1.9 @@ -1,23 +1,28 @@ -# $Id: Makefile.am,v 1.8 2000/07/06 10:47:03 vt Exp $ +# $Id: Makefile.am,v 1.9 2000/08/24 20:35:49 vt Exp $ BASE_FILES = ConfigReader.java \ Configuration.java \ PropertiesReader.java -if JSDK - JSDK_FILES = ServletConfigReader.java +XERCES_FILES = XmlConfiguration.java +if JSDK +JSDK_SUBSET = ${JSDK_FILES} else - -JSDK_FILES = +JSDK_SUBSET = +endif +if XERCES +XERCES_SUBSET = ${XERCES_FILES} +else +XERCES_SUBSET = endif -EXTRA_DIST = package.html ServletConfigReader.java +EXTRA_DIST = package.html ${JSDK_FILES} ${XERCES_FILES} noinst_PROGRAMS = package -package_SOURCES = ${BASE_FILES} ${JSDK_FILES} +package_SOURCES = ${BASE_FILES} ${JSDK_FILES} ${XERCES_SUBSET} ECHO = @ECHO@ JAVACX = @JAVACX@ 1.2 +287 -0 J4/src/java/gnu/j4/config/XmlConfiguration.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- |