ceki 01/03/21 13:34:34 Modified: src/java/org/apache/log4j AppenderSkeleton.java AsyncAppender.java Makefile src/java/org/apache/log4j/config PropertySetter.java src/java/org/apache/log4j/examples Makefile src/java/org/apache/log4j/gui Makefile src/java/org/apache/log4j/gui/examples Makefile src/java/org/apache/log4j/helpers Makefile src/java/org/apache/log4j/net Makefile SMTPAppender.java src/java/org/apache/log4j/net/test Makefile src/java/org/apache/log4j/nt Makefile src/java/org/apache/log4j/nt/test Makefile src/java/org/apache/log4j/or Makefile src/java/org/apache/log4j/performance Makefile src/java/org/apache/log4j/spi Makefile src/java/org/apache/log4j/varia Makefile src/java/org/apache/log4j/varia/test Makefile src/java/org/apache/log4j/xml Makefile src/java/org/apache/log4j/xml/examples Makefile src/java/org/apache/log4j/xml/test Makefile Added: src/java/org/apache/log4j/examples/appserver Makefile src/java/org/apache/log4j/test .cvsignore Log: Modified Mafiles to match the new directory structure starting at src/java/. Slowly restoring backward compatibility given the recent removal of all setOption/getOptionsString methods in all appender&layouts. Revision Changes Path 1.10 +28 -1 jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java Index: AppenderSkeleton.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- AppenderSkeleton.java 2001/03/19 12:38:17 1.9 +++ AppenderSkeleton.java 2001/03/21 21:33:51 1.10 @@ -37,7 +37,6 @@ There is no priority threshold filtering by default. */ protected Priority threshold; - /** It is assumed and enforced that errorHandler is never null. */ @@ -55,6 +54,17 @@ protected boolean closed = false; /** + A string constant used in naming the option for setting the + threshold for the appender. See also {@link #setThreshold + setThreshold} method. Current value of this string constant is + <b>Threshold</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String THRESHOLD_OPTION = "Threshold"; + + /** Derived appenders should override this method if option structure requires it. */ public @@ -243,6 +253,23 @@ public void setName(String name) { this.name = name; + } + + + /** + All classes derived from {@link AppenderSkeleton} admit the + <b>Threshold</b> option. The value of this option is a priority + string, such as "DEBUG", "INFO" and so on. All log events with + lower priority than the threshold priority are ignored by the + appender. + + <p>Configurable Appenders should override this method if they + admit additional options. */ + public + void setOption(String key, String value) { + if(key.equalsIgnoreCase(THRESHOLD_OPTION)) { + threshold = Priority.toPriority(value); + } } /** 1.13 +10 -8 jakarta-log4j/src/java/org/apache/log4j/AsyncAppender.java Index: AsyncAppender.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/AsyncAppender.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- AsyncAppender.java 2001/03/20 16:05:33 1.12 +++ AsyncAppender.java 2001/03/21 21:33:51 1.13 @@ -125,6 +125,15 @@ Appender getAppender(String name) { return aai.getAppender(name); } + + /** + Returns the current value of the <b>LocationInfo</b> option. + */ + public + boolean getLocationInfo() { + return locationInfo; + } + /** The <code>AsyncAppender</code> does not require a layout. Hence, @@ -143,7 +152,7 @@ synchronized public void removeAppender(Appender appender) { - aai.removeAppender(appender); + aai.removeAppender(appender); } synchronized @@ -168,13 +177,6 @@ locationInfo = flag; } - /** - Returns the current value of the <b>LocationInfo</b> option. - */ - public - boolean getLocationInfo() { - return locationInfo; - } /** The <b>BufferSize</b> option takes a non-negative integer 1.6 +2 -2 jakarta-log4j/src/java/org/apache/log4j/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile 2001/02/20 19:16:52 1.5 +++ Makefile 2001/03/21 21:33:52 1.6 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j -DEPTH :=../../.. +DEPTH :=../../../../.. JSOURCES:=HTMLLayout.java\ DailyRollingFileAppender.java\ RollingFileAppender.java\ @@ -24,7 +24,7 @@ WriterAppender.java\ ConsoleAppender.java\ -SUBDIRS :=helpers spi or xml net nt varia test performance examples gui +SUBDIRS :=helpers spi config or xml net nt varia test performance examples gui # include master-rule file include $(DEPTH)/make/make.inc 1.2 +22 -9 jakarta-log4j/src/java/org/apache/log4j/config/PropertySetter.java Index: PropertySetter.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/config/PropertySetter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PropertySetter.java 2001/03/19 12:31:42 1.1 +++ PropertySetter.java 2001/03/21 21:33:55 1.2 @@ -74,25 +74,38 @@ new PropertySetter(obj).setProperties(properties, prefix); } - // driven by property map + + /** + Set the properites for the object that match the + <code>prefix</code> passed as parameter. + + + */ public void setProperties(Properties properties, String prefix) { int len = prefix.length(); for (Enumeration e = properties.keys(); e.hasMoreElements(); ) { - String name = (String) e.nextElement(); + String key = (String) e.nextElement(); - if (name.startsWith(prefix)) { - if (name.indexOf('.', len + 1) > 0) continue; + // handle only properties that start with the desired frefix. + if (key.startsWith(prefix)) { + + + // ignore key if it contains dots after the prefix + if (key.indexOf('.', len + 1) > 0) { + //System.err.println("----------Ignoring---["+key + // +"], prefix=["+prefix+"]."); + continue; + } - //String value = properties.getProperty(name); - String value = OptionConverter.findAndSubst(name, properties); - name = name.substring(prefix.length()); - if ("layout".equals(name) && obj instanceof Appender) { + String value = OptionConverter.findAndSubst(key, properties); + key = key.substring(len); + if ("layout".equals(key) && obj instanceof Appender) { continue; } - setProperty(name, value); + setProperty(key, value); } } activate(); 1.4 +1 -1 jakarta-log4j/src/java/org/apache/log4j/examples/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 2001/01/24 10:24:06 1.3 +++ Makefile 2001/03/21 21:33:57 1.4 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/examples -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=SortAlgo.java Sort.java Trivial.java NumberCruncher.java\ NumberCruncherServer.java\ NumberCruncherClient.java\ 1.1 jakarta-log4j/src/java/org/apache/log4j/examples/appserver/Makefile Index: Makefile =================================================================== PKG_DIR :=org/apache/log4j/examples/appserver DEPTH :=../../../../../../.. JSOURCES:=AppServerCategory.java\ AppServerCategoryFactory.java\ AppServerLoggingEvent.java\ AppServerPatternLayout.java\ AppServerPatternParser.java\ SUBDIRS := # include master-rule file include $(DEPTH)/make/make.inc 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/gui/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/gui/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:07:40 1.2 +++ Makefile 2001/03/21 21:34:00 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/gui -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:= TextPaneAppender.java\ JListView.java\ JTableAppender.java\ 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/gui/examples/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/gui/examples/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:07:42 1.2 +++ Makefile 2001/03/21 21:34:02 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/gui/examples -DEPTH :=../../../../.. +DEPTH :=../../../../../../.. JSOURCES:= TextPaneAppenderExample.java\ ifdef FULL 1.5 +1 -1 jakarta-log4j/src/java/org/apache/log4j/helpers/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile 2000/12/26 23:20:29 1.4 +++ Makefile 2001/03/21 21:34:04 1.5 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/helpers -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=LogLog.java\ AppenderAttachableImpl.java\ TracerPrintWriter.java\ 1.6 +1 -1 jakarta-log4j/src/java/org/apache/log4j/net/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile 2001/01/08 01:37:56 1.5 +++ Makefile 2001/03/21 21:34:05 1.6 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/net -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=SyslogAppender.java\ JMSAppender.java\ JMSSink.java\ 1.18 +160 -17 jakarta-log4j/src/java/org/apache/log4j/net/SMTPAppender.java Index: SMTPAppender.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SMTPAppender.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- SMTPAppender.java 2001/03/19 12:38:19 1.17 +++ SMTPAppender.java 2001/03/21 21:34:06 1.18 @@ -56,6 +56,78 @@ Session session; Message msg; boolean locationInfo = false; + + + /** + A string constant used in naming the <em>To</em> field of + outgoing e-mail output file. Current value of this string + constant is <b>To</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String TO_OPTION = "To"; + + /** + A string constant used in naming the <em>From</em> field of + outgoing e-mail output file. Current value of this string + constant is <b>From</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String FROM_OPTION = "From"; + + /** + A string constant used in naming the <em>Subject</em> field of + outgoing e-mail output file. Current value of this string + constant is <b>Subject</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String SUBJECT_OPTION = "Subject"; + + + /** + A string constant used in naming the SMTP host that will be + contacted to send the e-mail. Current value of this string + constant is <b>SMTPHost</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String SMTP_HOST_OPTION = "SMTPHost"; + + /** + A string constant used in naming the cyclic buffer size option. + Current value of this string constant is <b>BufferSize</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String BUFFER_SIZE_OPTION = "BufferSize"; + + + /** + A string constant used in naming the class of the + TriggeringEventEvaluator that this SMTPApepdner wll use. Current + value of this string constant is <b>EvaluatorClass</b>. + + <p>Note that all option keys are case sensitive. + + */ + public static final String EVALUATOR_CLASS_OPTION = "EvaluatorClass"; + + + /** + A string constant used in naming the option for setting the the + location information flag. Current value of this string + constant is <b>LocationInfo</b>. + + <p>Note that all option keys are case sensitive. + */ + public static final String LOCATION_INFO_OPTION = "LocationInfo"; protected TriggeringEventEvaluator evaluator; @@ -184,6 +256,15 @@ } /** + Returns value of the <b>To</b> option. + */ + public + String getTo() { + return to; + } + + + /** The <code>SMTPAppender</code> requires a {@link Layout layout}. */ public @@ -234,23 +315,6 @@ } /** - The <b>To</b> option takes a string value which should be a - comma separated list of e-mail address of the recipients. - */ - public - void setTo(String to) { - this.to = to; - } - - /** - Returns value of the <b>To</b> option. - */ - public - String getTo() { - return to; - } - - /** The <b>From</b> option takes a string value which should be a e-mail address of the sender. */ @@ -266,6 +330,85 @@ String getFrom() { return from; } + + +/** + Set SMTPAppender specific options. + + <p>On top of the options of the super class {@link + AppenderSkeleton}, the recognized options are <b>To</b>, + <b>From</b>, <b>Subject</b>, <b>SMTPHost</b>, + <b>BufferSize</b>, <b>EvaluatorClass</b> and <b>LocationInfo</b>. + + <p>The <b>To</b> option takes a string value which should be a + comma separated list of e-mail address of the recipients. + + <p>The <b>From</b> option takes a string value which should be a + e-mail address of the sender. + + <p>The <b>Subject</b> option takes a string value which should be a + the subject of the e-mail message. + + <p>The <b>SMTPHost</b> option takes a string value which should be a + the host name of the SMTP server that will send the e-mail message. + + <p>The <b>BufferSize</b>option takes a positive integer + representing the maximum number of logging events to collect in a + cyclic buffer. When the <code>BufferSize</code> is reached, + oldest events are deleted as new events are added to the + buffer. By default the size of the cyclic buffer is 512 events. + + <p>The <b>EvaluatorClass</b> option takes a string value + repsenting the name of the class implementing the {@link + TriggeringEventEvaluator} interface. A corresponding object will + be instantiated and assigned as the triggering event evaluator + for the SMTPAppender. + + <p>The <b>LocationInfo</b> option takes a boolean value. By + default, it is set to false which means there will be no effort + to extract the location information related to the event. As a + result, the layout that formats the events as they are sent out + in an e-mail is likely to place the wrong location information + (if present in the format). + + <p>Location information extraction is comparatively very slow and + should be avoided unless performance is not a concern. + + */ + public + void setOption(String option, String value) { + if(value == null) return; + super.setOption(option, value); + + if(option.equals(TO_OPTION)) + to = value; + else if (option.equals(FROM_OPTION)) + from = value; + else if (option.equals(SMTP_HOST_OPTION)) + smtpHost = value; + else if (option.equals(SUBJECT_OPTION)) + subject = value; + else if (option.equals(EVALUATOR_CLASS_OPTION)) { + evaluator = (TriggeringEventEvaluator) + OptionConverter.instantiateByClassName(value, + TriggeringEventEvaluator.class, + evaluator); + } else if (option.equals(BUFFER_SIZE_OPTION)) { + bufferSize = OptionConverter.toInt(value, bufferSize); + cb.resize(bufferSize); + } else if (option.equals(LOCATION_INFO_OPTION)) + locationInfo = OptionConverter.toBoolean(value, locationInfo); + } + + /** + The <b>To</b> option takes a string value which should be a + comma separated list of e-mail address of the recipients. + */ + public + void setTo(String to) { + this.to = to; + } + /** The <b>Subject</b> option takes a string value which should be a 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/net/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/test/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:07:58 1.2 +++ Makefile 2001/03/21 21:34:08 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/net/test -DEPTH :=../../../../.. +DEPTH :=../../../../../../.. JSOURCES:=SyslogMin.java SocketMin.java Loop.java\ SMTPMin.java 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/nt/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/nt/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:08:00 1.2 +++ Makefile 2001/03/21 21:34:10 1.3 @@ -1,5 +1,5 @@ PKG_DIR :=org/apache/log4j/nt -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=NTEventLogAppender.java SUBDIRS :=test 1.4 +1 -1 jakarta-log4j/src/java/org/apache/log4j/nt/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/nt/test/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 2000/12/19 13:59:20 1.3 +++ Makefile 2001/03/21 21:34:12 1.4 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/nt/test -DEPTH :=../../../../.. +DEPTH :=../../../../../../.. JSOURCES:=NTMin.java SUBDIRS := 1.4 +1 -1 jakarta-log4j/src/java/org/apache/log4j/or/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/or/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 2000/12/27 23:27:04 1.3 +++ Makefile 2001/03/21 21:34:14 1.4 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/or -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:= ObjectRenderer.java\ RendererMap.java\ DefaultRenderer.java\ 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/performance/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:08:08 1.2 +++ Makefile 2001/03/21 21:34:16 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/performance -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=NOPWriter.java\ NotLogging.java\ Logging.java\ 1.5 +1 -1 jakarta-log4j/src/java/org/apache/log4j/spi/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile 2000/12/26 21:42:48 1.4 +++ Makefile 2001/03/21 21:34:18 1.5 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/spi -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=OptionHandler.java\ AppenderAttachable.java\ LoggingEvent.java\ 1.1 jakarta-log4j/src/java/org/apache/log4j/test/.cvsignore Index: .cvsignore =================================================================== test* current.reg* logging.lcf socket.lcf 1.5 +1 -1 jakarta-log4j/src/java/org/apache/log4j/varia/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/varia/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile 2001/02/13 17:37:50 1.4 +++ Makefile 2001/03/21 21:34:23 1.5 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/varia -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=ExternallyRolledFileAppender.java\ Roller.java\ DenyAllFilter.java\ 1.4 +1 -1 jakarta-log4j/src/java/org/apache/log4j/varia/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/varia/test/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 2000/12/19 13:59:21 1.3 +++ Makefile 2001/03/21 21:34:25 1.4 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/varia/test -DEPTH :=../../../../.. +DEPTH :=../../../../../../.. JSOURCES:=Loop.java SUBDIRS := 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/xml/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:08:38 1.2 +++ Makefile 2001/03/21 21:34:28 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/xml -DEPTH :=../../../.. +DEPTH :=../../../../../.. JSOURCES:=DOMConfigurator.java\ XMLLayout.java\ 1.3 +1 -1 jakarta-log4j/src/java/org/apache/log4j/xml/examples/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/examples/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile 2000/12/14 21:08:40 1.2 +++ Makefile 2001/03/21 21:34:30 1.3 @@ -1,6 +1,6 @@ PKG_DIR :=org/apache/log4j/xml/examples -DEPTH :=../../../../.. +DEPTH :=../../../../../../.. JSOURCES:=ReportParserError.java XMLSample.java XPriority.java\ XCategory.java XTest.java 1.5 +3 -2 jakarta-log4j/src/java/org/apache/log4j/xml/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/test/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile 2001/01/22 22:11:42 1.4 +++ Makefile 2001/03/21 21:34:32 1.5 @@ -1,9 +1,10 @@ PKG_DIR :=org/apache/log4j/xml/test -DEPTH :=../../../../.. -JSOURCES:=DOMTest.java DisableOverrideTest.java DisableTest.java \ +DEPTH :=../../../../../../.. +JSOURCES:=DOMTest.java DisableOverrideTest.java \ SubClassTest.java\ +#DisableTest.java \ SUBDIRS := # include master-rule file --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]