Author: carnold
Date: Thu Aug 16 16:20:08 2007
New Revision: 566885
URL: http://svn.apache.org/viewvc?view=rev&rev=566885
Log:
Bug 43151: Add TimeFilter to extras companion
Added:
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/filter/TimeFilter.java
logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/filter/TimeFilterTest.java
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.log
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.xml
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.log
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.xml
Added:
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/filter/TimeFilter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/filter/TimeFilter.java?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/filter/TimeFilter.java
(added)
+++
logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/filter/TimeFilter.java
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.filter;
+
+import org.apache.log4j.helpers.LogLog;
+import org.apache.log4j.spi.Filter;
+import org.apache.log4j.spi.LoggingEvent;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+/**
+ * Filters events that fall within a specified time period
+ * in each day.
+ *
+*/
+public final class TimeFilter extends Filter {
+
+ private boolean acceptOnMatch;
+ /**
+ * Starting offset from midnight in milliseconds.
+ */
+ private long start;
+ /**
+ * Ending offset from midnight in milliseconds.
+ */
+ private long end;
+ /**
+ * Timezone.
+ */
+ private Calendar calendar;
+
+
+ /**
+ * Length of hour in milliseconds.
+ */
+ private static final long HOUR_MS = 3600000;
+
+ /**
+ * Length of minute in milliseconds.
+ */
+ private static final long MINUTE_MS = 60000;
+
+ /**
+ * Length of second in milliseconds.
+ */
+ private static final long SECOND_MS = 1000;
+
+ /**
+ * Constructor.
+ */
+ public TimeFilter() {
+ acceptOnMatch = true;
+ start = 0;
+ end = Long.MAX_VALUE;
+ calendar = Calendar.getInstance();
+ }
+
+ /**
+ * Set start (inclusive) of time span.
+ * @param s string representation of start time as HH:mm:ss.
+ */
+ public void setStart(final String s) {
+ SimpleDateFormat stf = new SimpleDateFormat("HH:mm:ss");
+ stf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ try {
+ start = stf.parse(s).getTime();
+ } catch(ParseException ex) {
+ LogLog.warn("Error parsing start value " + s, ex);
+ }
+ }
+
+ /**
+ * Set end (exclusive) of time span.
+ * @param s string representation of end time as HH:mm:ss.
+ */
+ public void setEnd(final String s) {
+ SimpleDateFormat stf = new SimpleDateFormat("HH:mm:ss");
+ stf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ try {
+ end = stf.parse(s).getTime();
+ } catch(ParseException ex) {
+ LogLog.warn("Error parsing end value " + s, ex);
+ }
+ }
+
+ /**
+ * Set timezone.
+ * @param s time zone.
+ */
+ public void setTimeZone(final String s) {
+ if (s == null) {
+ calendar = Calendar.getInstance();
+ } else {
+ calendar = Calendar.getInstance(TimeZone.getTimeZone(s));
+ }
+ }
+
+ /**
+ * Sets whether an event within the timespan should be accepted or denied.
+ * @param acceptOnMatch true if matching event should be accepted.
+ */
+ public synchronized void setAcceptOnMatch(boolean acceptOnMatch) {
+ this.acceptOnMatch = acceptOnMatch;
+ }
+
+ /**
+ * Gets whether an event within the timespan should be accepted or denied.
+ * @return true if matching event should be accepted.
+ */
+ public synchronized boolean getAcceptOnMatch() {
+ return acceptOnMatch;
+ }
+
+ /** [EMAIL PROTECTED] */
+ public int decide(final LoggingEvent event) {
+ calendar.setTimeInMillis(event.timeStamp);
+ //
+ // get apparent number of milliseconds since midnight
+ // (ignores extra or missing hour on daylight time changes).
+ //
+ long apparentOffset = calendar.get(Calendar.HOUR_OF_DAY) * HOUR_MS +
+ calendar.get(Calendar.MINUTE) * MINUTE_MS +
+ calendar.get(Calendar.SECOND) * SECOND_MS +
+ calendar.get(Calendar.MILLISECOND);
+ if (apparentOffset >= start && apparentOffset < end) {
+ if (acceptOnMatch) {
+ return Filter.ACCEPT;
+ } else {
+ return Filter.DENY;
+ }
+ }
+ return Filter.NEUTRAL;
+ }
+}
+
Added:
logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/filter/TimeFilterTest.java
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/filter/TimeFilterTest.java?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/filter/TimeFilterTest.java
(added)
+++
logging/log4j/companions/extras/trunk/src/test/java/org/apache/log4j/filter/TimeFilterTest.java
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.filter;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.extras.DOMConfigurator;
+import org.apache.log4j.spi.Filter;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.util.Compare;
+import org.apache.log4j.xml.Log4jEntityResolver;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+/**
+ * Tests for TimeFilter.
+ *
+ */
+public class TimeFilterTest extends TestCase {
+ /**
+ * Construct new instance.
+ * @param testName test name.
+ */
+ public TimeFilterTest(final String testName) {
+ super(testName);
+ }
+
+ /**
+ * Configure log4j from resource.
+ * @param resourceName resource name.
+ * @throws Exception if IO or other error.
+ */
+ private final void configure(final String resourceName) throws Exception {
+ Logger.getRootLogger().getLoggerRepository().resetConfiguration();
+ InputStream is = getClass().getResourceAsStream(resourceName);
+ if (is == null) {
+ throw new FileNotFoundException(
+ "Could not find resource " + resourceName);
+ }
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setEntityResolver(new Log4jEntityResolver());
+ Document doc = builder.parse(is);
+ DOMConfigurator.configure(doc.getDocumentElement());
+ }
+
+
+ /**
+ * Test 2 AM events against a 2 AM - 3 AM filter.
+ * @param tz time zone, may be null.
+ * @param dayIncrement days in advance of current date.
+ */
+ private void common2AM(String tz, int dayIncrement) {
+ TimeFilter timeFilter = new TimeFilter();
+ timeFilter.setStart("02:00:00");
+ timeFilter.setEnd("03:00:00");
+ if (tz != null) {
+ timeFilter.setTimeZone(tz);
+ }
+ timeFilter.activateOptions();
+
+ Calendar cal;
+ if (tz == null) {
+ cal = Calendar.getInstance();
+ } else {
+ cal = Calendar.getInstance(TimeZone.getTimeZone(tz));
+ }
+ cal.set(Calendar.HOUR_OF_DAY, 2);
+ if (dayIncrement != 0) {
+ cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) +
dayIncrement);
+ }
+ LoggingEvent event = new LoggingEvent("org.apache.log4j.Logger",
+ Logger.getLogger(TimeFilterTest.class),
+ cal.getTimeInMillis(), Level.INFO, "Hello, world.", null);
+ assertEquals(Filter.ACCEPT, timeFilter.decide(event));
+ timeFilter.setAcceptOnMatch(false);
+ assertEquals(Filter.DENY, timeFilter.decide(event));
+ }
+
+ /**
+ * Test 3 AM events against a 2 AM - 3 AM filter.
+ * @param tz time zone, may be null.
+ * @param dayIncrement days in advance of current date.
+ */
+ private void common3AM(String tz, int dayIncrement) {
+ TimeFilter timeFilter = new TimeFilter();
+ timeFilter.setStart("02:00:00");
+ timeFilter.setEnd("03:00:00");
+ if (tz != null) {
+ timeFilter.setTimeZone(tz);
+ }
+ timeFilter.activateOptions();
+
+ Calendar cal;
+ if (tz == null) {
+ cal = Calendar.getInstance();
+ } else {
+ cal = Calendar.getInstance(TimeZone.getTimeZone(tz));
+ }
+ cal.set(Calendar.HOUR_OF_DAY, 3);
+ if (dayIncrement != 0) {
+ cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) +
dayIncrement);
+ }
+ LoggingEvent event = new LoggingEvent("org.apache.log4j.Logger",
+ Logger.getLogger(TimeFilterTest.class),
+ cal.getTimeInMillis(), Level.INFO, "Hello, world.", null);
+ assertEquals(Filter.NEUTRAL, timeFilter.decide(event));
+ timeFilter.setAcceptOnMatch(false);
+ assertEquals(Filter.NEUTRAL, timeFilter.decide(event));
+ timeFilter.setAcceptOnMatch(true);
+ }
+
+ /**
+ * Test 2 AM local today event against 2 AM - 3 AM local time filter.
+ */
+ public void test2AMLocal() {
+ common2AM(null, 0);
+ }
+
+ /**
+ * Test 2 AM local yesterday event against 2 AM - 3 AM local time filter.
+ */
+ public void test2AMLocalYesterday() {
+ common2AM(null, -1);
+ }
+
+ /**
+ * Test 2 AM local tomorrow event against 2 AM - 3 AM local time filter.
+ */
+ public void test2AMLocalTomorrow() {
+ common2AM(null, 1);
+ }
+
+ /**
+ * Test 2 AM local last week event against 2 AM - 3 AM local time filter.
+ */
+ public void test2AMLocalLastWeek() {
+ common2AM(null, -7);
+ }
+
+ /**
+ * Test 2 AM local next week event against 2 AM - 3 AM local time filter.
+ */
+ public void test2AMLocalNextWeek() {
+ common2AM(null, 7);
+ }
+
+ /**
+ * Test 3 AM local today event against 2 AM - 3 AM local time filter.
+ */
+ public void test3AMLocal() {
+ common3AM(null, 0);
+ }
+
+ /**
+ * Test 3 AM local yesterday event against 2 AM - 3 AM local time filter.
+ */
+ public void test3AMLocalYesterday() {
+ common3AM(null, -1);
+ }
+
+ /**
+ * Test 3 AM local tomorrow event against 2 AM - 3 AM local time filter.
+ */
+ public void test3AMLocalTomorrow() {
+ common3AM(null, 1);
+ }
+
+ /**
+ * Test 3 AM local last week event against 2 AM - 3 AM local time filter.
+ */
+ public void test3AMLocalLastWeek() {
+ common3AM(null, -7);
+ }
+
+ /**
+ * Test 3 AM local next week event against 2 AM - 3 AM local time filter.
+ */
+ public void test3AMLocalNextWeek() {
+ common3AM(null, 7);
+ }
+
+ /**
+ * Test 2 AM UTC today event against 2 AM - 3 AM UTC filter.
+ */
+ public void test2AMUTC() {
+ common2AM("UTC", 0);
+ }
+
+ /**
+ * Test 3 AM UTC today event against 2 AM - 3 AM UTC filter.
+ */
+ public void test3AMUTC() {
+ common3AM("UTC", 0);
+ }
+
+ /**
+ * Log events every 15 minutes from midnight to midnight in
+ * using specified calendar.
+ * @param cal calendar.
+ */
+ private void common(Calendar cal) {
+ Logger logger = Logger.getLogger(TimeFilterTest.class);
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ for (int hour = 0; hour < 24; hour++) {
+ for (int minute = 0; minute < 60; minute += 15) {
+ cal.set(Calendar.HOUR_OF_DAY, hour);
+ cal.set(Calendar.MINUTE, minute);
+ LoggingEvent event = new
LoggingEvent("org.apache.log4j.Logger",
+ logger,
+ cal.getTimeInMillis(), Level.INFO, "Hello, world.",
null);
+ logger.callAppenders(event);
+ }
+ }
+ }
+
+
+ /**
+ * Test 2 AM-3AM local time accept on match filter.
+ * @throws Exception if IO exception.
+ */
+ public void testConfig1() throws Exception {
+ configure("timeFilter1.xml");
+ common(Calendar.getInstance());
+
+ assertTrue(Compare.compare(TimeFilterTest.class,
+ "timeFilter.1", "timeFilter1.log"));
+ }
+
+ /**
+ * Test 2 AM-3AM UTC reject on match filter.
+ * @throws Exception if IO exception.
+ */
+ public void testConfig2() throws Exception {
+ configure("timeFilter2.xml");
+ common(Calendar.getInstance(TimeZone.getTimeZone("UTC")));
+
+ assertTrue(Compare.compare(TimeFilterTest.class,
+ "timeFilter.2", "timeFilter2.log"));
+ }
+
+}
Added:
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.log
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.log?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.log
(added)
+++
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.log
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,4 @@
+02:00:00 - Hello, world.
+02:15:00 - Hello, world.
+02:30:00 - Hello, world.
+02:45:00 - Hello, world.
Added:
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.xml
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.xml?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.xml
(added)
+++
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter1.xml
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
+
+ <appender name="A1" class="org.apache.log4j.FileAppender">
+
+ <param name="Append" value="false" />
+ <param name="File" value="timeFilter.1" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss} - %m\n"/>
+ </layout>
+ <!-- Accept all LoggingEvents containing the string
+ "1" in the message field. -->
+ <filter class="org.apache.log4j.filter.TimeFilter">
+ <param name="start" value="02:00:00"/>
+ <param name="end" value="03:00:00"/>
+ </filter>
+ <!-- Deny (filter out) everything else. -->
+ <filter class="org.apache.log4j.filter.DenyAllFilter"/>
+ </appender>
+
+
+ <root>
+ <appender-ref ref="A1" />
+ </root>
+</log4j:configuration>
Added:
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.log
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.log?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.log
(added)
+++
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.log
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,92 @@
+00:00:00 - Hello, world.
+00:15:00 - Hello, world.
+00:30:00 - Hello, world.
+00:45:00 - Hello, world.
+01:00:00 - Hello, world.
+01:15:00 - Hello, world.
+01:30:00 - Hello, world.
+01:45:00 - Hello, world.
+03:00:00 - Hello, world.
+03:15:00 - Hello, world.
+03:30:00 - Hello, world.
+03:45:00 - Hello, world.
+04:00:00 - Hello, world.
+04:15:00 - Hello, world.
+04:30:00 - Hello, world.
+04:45:00 - Hello, world.
+05:00:00 - Hello, world.
+05:15:00 - Hello, world.
+05:30:00 - Hello, world.
+05:45:00 - Hello, world.
+06:00:00 - Hello, world.
+06:15:00 - Hello, world.
+06:30:00 - Hello, world.
+06:45:00 - Hello, world.
+07:00:00 - Hello, world.
+07:15:00 - Hello, world.
+07:30:00 - Hello, world.
+07:45:00 - Hello, world.
+08:00:00 - Hello, world.
+08:15:00 - Hello, world.
+08:30:00 - Hello, world.
+08:45:00 - Hello, world.
+09:00:00 - Hello, world.
+09:15:00 - Hello, world.
+09:30:00 - Hello, world.
+09:45:00 - Hello, world.
+10:00:00 - Hello, world.
+10:15:00 - Hello, world.
+10:30:00 - Hello, world.
+10:45:00 - Hello, world.
+11:00:00 - Hello, world.
+11:15:00 - Hello, world.
+11:30:00 - Hello, world.
+11:45:00 - Hello, world.
+12:00:00 - Hello, world.
+12:15:00 - Hello, world.
+12:30:00 - Hello, world.
+12:45:00 - Hello, world.
+13:00:00 - Hello, world.
+13:15:00 - Hello, world.
+13:30:00 - Hello, world.
+13:45:00 - Hello, world.
+14:00:00 - Hello, world.
+14:15:00 - Hello, world.
+14:30:00 - Hello, world.
+14:45:00 - Hello, world.
+15:00:00 - Hello, world.
+15:15:00 - Hello, world.
+15:30:00 - Hello, world.
+15:45:00 - Hello, world.
+16:00:00 - Hello, world.
+16:15:00 - Hello, world.
+16:30:00 - Hello, world.
+16:45:00 - Hello, world.
+17:00:00 - Hello, world.
+17:15:00 - Hello, world.
+17:30:00 - Hello, world.
+17:45:00 - Hello, world.
+18:00:00 - Hello, world.
+18:15:00 - Hello, world.
+18:30:00 - Hello, world.
+18:45:00 - Hello, world.
+19:00:00 - Hello, world.
+19:15:00 - Hello, world.
+19:30:00 - Hello, world.
+19:45:00 - Hello, world.
+20:00:00 - Hello, world.
+20:15:00 - Hello, world.
+20:30:00 - Hello, world.
+20:45:00 - Hello, world.
+21:00:00 - Hello, world.
+21:15:00 - Hello, world.
+21:30:00 - Hello, world.
+21:45:00 - Hello, world.
+22:00:00 - Hello, world.
+22:15:00 - Hello, world.
+22:30:00 - Hello, world.
+22:45:00 - Hello, world.
+23:00:00 - Hello, world.
+23:15:00 - Hello, world.
+23:30:00 - Hello, world.
+23:45:00 - Hello, world.
Added:
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.xml
URL:
http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.xml?view=auto&rev=566885
==============================================================================
---
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.xml
(added)
+++
logging/log4j/companions/extras/trunk/src/test/resources/org/apache/log4j/filter/timeFilter2.xml
Thu Aug 16 16:20:08 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
+
+ <appender name="A1" class="org.apache.log4j.FileAppender">
+
+ <param name="Append" value="false" />
+ <param name="File" value="timeFilter.2" />
+
+ <layout class="org.apache.log4j.EnhancedPatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss}{UTC} - %m\n"/>
+ </layout>
+ <!-- Accept all LoggingEvents containing the string
+ "1" in the message field. -->
+ <filter class="org.apache.log4j.filter.TimeFilter">
+ <param name="start" value="02:00:00"/>
+ <param name="end" value="03:00:00"/>
+ <param name="timeZone" value="UTC-6"/>
+ <param name="acceptOnMatch" value="false"/>
+ </filter>
+ </appender>
+
+
+ <root>
+ <appender-ref ref="A1" />
+ </root>
+</log4j:configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]