ceki 01/04/18 09:24:21
Modified: src/java/org/apache/log4j Makefile RollingFileAppender.java
Added: src/java/org/apache/log4j RollingFileAppenderBeanInfo.java
Log:
A convoluted but seemingly working attempt at resolving the setMaxFileSize problem.
Revision Changes Path
1.8 +1 -0 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile 2001/03/28 16:30:24 1.7
+++ Makefile 2001/04/18 16:24:15 1.8
@@ -8,6 +8,7 @@
PatternLayout.java\
AsyncAppender.java\
NDC.java\
+ RollingFileAppenderBeanInfo.java\
AppenderSkeleton.java\
CategoryKey.java\
ProvisionNode.java\
1.10 +5 -5 jakarta-log4j/src/java/org/apache/log4j/RollingFileAppender.java
Index: RollingFileAppender.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/RollingFileAppender.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- RollingFileAppender.java 2001/04/17 22:32:24 1.9
+++ RollingFileAppender.java 2001/04/18 16:24:16 1.10
@@ -153,14 +153,14 @@
return maxBackupIndex;
}
- /*
+ /**
Set the maximum size that the output file is allowed to reach
before being rolled over to backup files.
*/
- //public
- //void setMaxFileSize(long maxFileSize) {
- //this.maxFileSize = maxFileSize;
- //}
+ public
+ void setMaxFileSize(long maxFileSize) {
+ this.maxFileSize = maxFileSize;
+ }
/**
Set the maximum size that the output file is allowed to reach
1.1
jakarta-log4j/src/java/org/apache/log4j/RollingFileAppenderBeanInfo.java
Index: RollingFileAppenderBeanInfo.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software
* License version 1.1, a copy of which has been included with this
* distribution in the LICENSE.APL file. */
package org.apache.log4j;
import java.beans.*;
import org.apache.log4j.helpers.LogLog;
import java.lang.reflect.Method;
public class RollingFileAppenderBeanInfo extends SimpleBeanInfo {
private PropertyDescriptor[] props;
public
RollingFileAppenderBeanInfo() {
Class clazz = RollingFileAppender.class;
try {
// the magic is here
BeanInfo bi = Introspector.getBeanInfo(clazz,
Introspector.IGNORE_ALL_BEANINFO);
props = bi.getPropertyDescriptors();
if(props != null) {
for(int i = 0; i < props.length; i++) {
if(props[i].getName().equals("maxFileSize")) {
Method m = clazz.getMethod("setMaxFileSize",
new Class[] {String.class});
props[i] = new PropertyDescriptor("maxFileSize", null, m);
}
}
}
// flush the bean info because getPropertyDescriptors() will now return
// different properties
Introspector.flushFromCaches(RollingFileAppender.class);
} catch(IntrospectionException e) {
LogLog.error("Could not inspect RollingFileAppender.", e);
} catch(NoSuchMethodException e) {
LogLog.error("Could find setter method for RollingFileAppender.", e);
}
}
public
PropertyDescriptor[] getPropertyDescriptors() {
return props;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]