ceki 01/06/26 11:29:03 Modified: src/java/org/apache/log4j Category.java src/java/org/apache/log4j/examples/appserver AppServerCategory.java AppServerLoggingEvent.java src/java/org/apache/log4j/test Makefile src/java/org/apache/log4j/xml/examples XCategory.java Log: - Fixed bug 2316. - After Paul's observation, removed the Category#getFQCN method. Revision Changes Path 1.34 +41 -43 jakarta-log4j/src/java/org/apache/log4j/Category.java Index: Category.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Category.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- Category.java 2001/06/26 10:57:34 1.33 +++ Category.java 2001/06/26 18:28:45 1.34 @@ -16,6 +16,7 @@ // Michael Horwitz <[EMAIL PROTECTED]> // Calvin Chan <[EMAIL PROTECTED]> // Aaron Greenhouse <[EMAIL PROTECTED]> +// Beat Meier <[EMAIL PROTECTED]> package org.apache.log4j; @@ -309,12 +310,12 @@ if(hierarchy.disable >= Priority.DEBUG_INT) return; if(Priority.DEBUG.isGreaterOrEqual(this.getChainedPriority())) { - forcedLog(getFQCN(), Priority.DEBUG, message, null); + forcedLog(FQCN, Priority.DEBUG, message, null); } } - /** + /** Log a message object with the <code>DEBUG</code> priority including the stack trace of the {@link Throwable} <code>t</code> passed as parameter. @@ -325,9 +326,10 @@ @param t the exception to log, including its stack trace. */ public void debug(Object message, Throwable t) { - if(hierarchy.disable >= Priority.DEBUG_INT) return; - if(this.isEnabledFor(Priority.DEBUG)) - forcedLog(getFQCN(), Priority.DEBUG, message, t); + if(hierarchy.disable >= Priority.DEBUG_INT) + return; + if(Priority.DEBUG.isGreaterOrEqual(this.getChainedPriority())) + forcedLog(FQCN, Priority.DEBUG, message, t); } //public @@ -359,9 +361,10 @@ @param message the message object to log */ public void error(Object message) { - if(hierarchy.disable >= Priority.ERROR_INT) return; - if(this.isEnabledFor(Priority.ERROR)) - forcedLog(getFQCN(), Priority.ERROR, message, null); + if(hierarchy.disable >= Priority.ERROR_INT) + return; + if(Priority.ERROR.isGreaterOrEqual(this.getChainedPriority())) + forcedLog(FQCN, Priority.ERROR, message, null); } /** @@ -375,9 +378,10 @@ @param t the exception to log, including its stack trace. */ public void error(Object message, Throwable t) { - if(hierarchy.disable >= Priority.ERROR_INT) return; - if(this.isEnabledFor(Priority.ERROR)) - forcedLog(getFQCN(), Priority.ERROR, message, t); + if(hierarchy.disable >= Priority.ERROR_INT) + return; + if(Priority.ERROR.isGreaterOrEqual(this.getChainedPriority())) + forcedLog(FQCN, Priority.ERROR, message, t); } @@ -415,9 +419,10 @@ @param message the message object to log */ public void fatal(Object message) { - if(hierarchy.disable >= Priority.FATAL_INT) return; + if(hierarchy.disable >= Priority.FATAL_INT) + return; if(Priority.FATAL.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), Priority.FATAL, message, null); + forcedLog(FQCN, Priority.FATAL, message, null); } /** @@ -431,9 +436,10 @@ @param t the exception to log, including its stack trace. */ public void fatal(Object message, Throwable t) { - if(hierarchy.disable >= Priority.FATAL_INT) return; + if(hierarchy.disable >= Priority.FATAL_INT) + return; if(Priority.FATAL.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), Priority.FATAL, message, t); + forcedLog(FQCN, Priority.FATAL, message, t); } @@ -527,20 +533,6 @@ /** - The value returned by this method is used as a hint to determine - the correct caller localization information. - - <p>Subclasses should override this method to return their own - fully qualified class name. - - @since 1.2 */ - protected - String getFQCN() { - return Category.FQCN; - } - - - /** Return the the {@link Hierarchy} where this <code>Category</code> instance is attached. @@ -713,9 +705,10 @@ @param message the message object to log */ public void info(Object message) { - if(hierarchy.disable >= Priority.INFO_INT) return; + if(hierarchy.disable >= Priority.INFO_INT) + return; if(Priority.INFO.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), Priority.INFO, message, null); + forcedLog(FQCN, Priority.INFO, message, null); } /** @@ -729,9 +722,10 @@ @param t the exception to log, including its stack trace. */ public void info(Object message, Throwable t) { - if(hierarchy.disable >= Priority.INFO_INT) return; + if(hierarchy.disable >= Priority.INFO_INT) + return; if(Priority.INFO.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), Priority.INFO, message, t); + forcedLog(FQCN, Priority.INFO, message, t); } /** @@ -785,9 +779,8 @@ */ public boolean isEnabledFor(Priority priority) { - if(hierarchy.disable >= priority.level) { + if(hierarchy.disable >= priority.level) return false; - } return priority.isGreaterOrEqual(this.getChainedPriority()); } @@ -826,7 +819,7 @@ if(msg == null) { msg = key; } - forcedLog(getFQCN(), priority, msg, t); + forcedLog(FQCN, priority, msg, t); } } /** @@ -850,7 +843,7 @@ msg = key; else msg = java.text.MessageFormat.format(pattern, params); - forcedLog(getFQCN(), priority, msg, t); + forcedLog(FQCN, priority, msg, t); } } @@ -863,7 +856,7 @@ return; } if(priority.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), priority, message, t); + forcedLog(FQCN, priority, message, t); } /** @@ -875,7 +868,7 @@ return; } if(priority.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(getFQCN(), priority, message, null); + forcedLog(FQCN, priority, message, null); } /** @@ -1022,8 +1015,11 @@ @param message the message object to log. */ public void warn(Object message) { - if(this.isEnabledFor(Priority.WARN)) - forcedLog(getFQCN(), Priority.WARN, message, null); + if(hierarchy.disable >= Priority.WARN_INT) + return; + + if(Priority.WARN.isGreaterOrEqual(this.getChainedPriority())) + forcedLog(FQCN, Priority.WARN, message, null); } /** @@ -1037,7 +1033,9 @@ @param t the exception to log, including its stack trace. */ public void warn(Object message, Throwable t) { - if(this.isEnabledFor(Priority.WARN)) - forcedLog(getFQCN(), Priority.WARN, message, t); + if(hierarchy.disable >= Priority.WARN_INT) + return; + if(Priority.WARN.isGreaterOrEqual(this.getChainedPriority())) + forcedLog(FQCN, Priority.WARN, message, t); } } 1.10 +2 -1 jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategory.java Index: AppServerCategory.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerCategory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- AppServerCategory.java 2001/06/25 07:06:24 1.9 +++ AppServerCategory.java 2001/06/26 18:28:52 1.10 @@ -186,7 +186,8 @@ * <code>AppServerLoggingEvent</code> is sent to the * appenders. */ - protected void forcedLog(String fqn, Priority priority, Object message, Throwable t) { + protected + void forcedLog(String fqn, Priority priority, Object message, Throwable t) { LoggingEvent event = new AppServerLoggingEvent(fqn, this, priority, message, t); callAppenders( event ); } 1.4 +29 -35 jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerLoggingEvent.java Index: AppServerLoggingEvent.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/examples/appserver/AppServerLoggingEvent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AppServerLoggingEvent.java 2001/03/05 04:52:39 1.3 +++ AppServerLoggingEvent.java 2001/06/26 18:28:53 1.4 @@ -24,50 +24,44 @@ * @author Paul Glezen */ public class AppServerLoggingEvent extends LoggingEvent - implements java.io.Serializable -{ - /** Hostname of machine from which this event originated. */ - public String hostname; + implements java.io.Serializable { + /** Hostname of machine from which this event originated. */ + public String hostname; + + /** Name of component from which this event originated. */ + public String component; + + /** Name of server from which this event originated. This + attribute may be more germane to CORBA/EJB environments. */ + public String server; + + /** Version name of server/component. */ + public String version; + - /** Name of component from which this event originated. */ - public String component; - - /** Name of server from which this event originated. This - attribute may be more germane to CORBA/EJB environments. */ - public String server; - - /** Version name of server/component. */ - public String version; - - /** * Instantiate an AppServerLoggingEvent from the supplied parameters. * <p> - * All the fields of + * All the fields of * <code>AppServerLoggingEvent</code> are obtained from - * <code>AppServerCategory</code> or filled when actually needed. + * <code>AppServerCategory</code> or filled when actually needed. * <p> * @param fqnOfCategoryClass The Category class name. * @param category The category of this event. * @param priority The priority of this event. * @param message The message of this event. * @param throwable The throwable of this event. - */ - public AppServerLoggingEvent( String fqnOfCategoryClass, - AppServerCategory category, - Priority priority, - Object message, - Throwable throwable) - { - super( fqnOfCategoryClass, - category, - priority, - message, - throwable ); - - hostname = category.getHostname(); - component = category.getComponent(); - server = category.getServer(); - version = category.getVersion(); - } + */ + public AppServerLoggingEvent( String fqnOfCategoryClass, + AppServerCategory category, + Priority priority, + Object message, + Throwable throwable) { + super(fqnOfCategoryClass, category, priority, message, throwable); + + hostname = category.getHostname(); + component = category.getComponent(); + server = category.getServer(); + version = category.getVersion(); + } } 1.14 +1 -1 jakarta-log4j/src/java/org/apache/log4j/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Makefile 2001/06/06 16:07:27 1.13 +++ Makefile 2001/06/26 18:28:57 1.14 @@ -27,7 +27,7 @@ SocketAppenderTest.java\ PrintProperties.java\ CustomCategoryTest.java\ - + FQCNTest.java\ ifdef $(ISJDK1) JSOURCES:=$(JSOURCES) UnitTestOR.java 1.11 +4 -9 jakarta-log4j/src/java/org/apache/log4j/xml/examples/XCategory.java Index: XCategory.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/examples/XCategory.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- XCategory.java 2001/06/26 11:01:52 1.10 +++ XCategory.java 2001/06/26 18:29:00 1.11 @@ -116,11 +116,10 @@ XPriority#LETHAL}. */ public void lethal(String message, Throwable t) { - // disable is a static variable defined in Category class if(hierarchy.isDisabled(XPriority.LETHAL_INT)) return; if(XPriority.LETHAL.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(FQCN, XPriority.LETHAL, message, t); + forcedLog(getFQCN(), XPriority.LETHAL, message, t); } /** @@ -128,11 +127,10 @@ XPriority#LETHAL}. */ public void lethal(String message) { - // disable is a static variable defined in Category class if(hierarchy.isDisabled(XPriority.LETHAL_INT)) return; if(XPriority.LETHAL.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(FQCN, XPriority.LETHAL, message, null); + forcedLog(getFQCN(), XPriority.LETHAL, message, null); } @@ -166,11 +164,10 @@ */ public void trace(String message, Throwable t) { - // disable is defined in Category if(hierarchy.isDisabled(XPriority.TRACE_INT)) return; if(XPriority.TRACE.isGreaterOrEqual(this.getChainedPriority())) - forcedLog(FQCN, XPriority.TRACE, message, t); + forcedLog(getFQCN(), XPriority.TRACE, message, t); } /** @@ -178,12 +175,10 @@ */ public void trace(String message) { - // disable is defined in Category if(hierarchy.isDisabled(XPriority.TRACE_INT)) return; if(XPriority.TRACE.isGreaterOrEqual(this.getChainedPriority())) - callAppenders(new LoggingEvent(FQCN, this, XPriority.TRACE, - message, null)); + forcedLog(getFQCN(), XPriority.TRACE, message, null); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]