Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/PropertyConfigurator.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/PropertyConfigurator.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/PropertyConfigurator.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/PropertyConfigurator.java Wed Jan 18 09:05:18 2006 @@ -12,7 +12,7 @@ package org.apache.log4j; -import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.apache.log4j.Priority; import org.apache.log4j.spi.OptionHandler; import org.apache.log4j.helpers.LogLog; @@ -35,13 +35,14 @@ files. You can enable log4j internal logging by defining the <b>log4j.debug</b> variable. - <P>At the initialization of the Category class, the file + <P>At the initialization of the Logger class, the file <b>log4j.properties</b> will be searched from the search path used to load classes. If the file can be found, then it will be fed to the [EMAIL PROTECTED] PropertyConfigurator#configure(java.net.URL)} method. @author Ceki Gülcü + * @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> @since log4jME 1.0 */ public class PropertyConfigurator { @@ -51,11 +52,10 @@ */ protected Hashtable registry = new Hashtable(11); - static final String CATEGORY_PREFIX = "log4j.category."; + static final String LOGGER_PREFIX = "log4j.logger."; static final String ADDITIVITY_PREFIX = "log4j.additivity."; - static final String ROOT_CATEGORY_PREFIX = "log4j.rootCategory"; + static final String ROOT_LOGGER_PREFIX = "log4j.rootLogger"; static final String APPENDER_PREFIX = "log4j.appender."; - static final String CATEGORY_FACTORY_KEY = "log4j.categoryFactory"; static final private String INHERITED = "inherited"; static final private String INTERNAL_ROOT_NAME = "root"; @@ -90,11 +90,11 @@ log.appender.appenderName.layout.optionN=valueN </pre> - <h3>Configuring categories</h3> + <h3>Configuring Loggers</h3> - <p>The syntax for configuring the root category is: + <p>The syntax for configuring the root Logger is: <pre> - log4j.rootCategory=[FATAL|ERROR|WARN|INFO|DEBUG], appenderName, appenderName, ... + log4j.rootLogger=[FATAL|ERROR|WARN|INFO|DEBUG], appenderName, appenderName, ... </pre> <p>This syntax means that one of the strings values ERROR, WARN, @@ -106,34 +106,34 @@ priority. If no priority value is specified, then the root priority remains untouched. - <p>The root category can be assigned multiple appenders. + <p>The root Logger can be assigned multiple appenders. <p>Each <i>appenderName</i> (seperated by commas) will be added to - the root category. The named appender is defined using the + the root Logger. The named appender is defined using the appender syntax defined above. - <p>For non-root categories the syntax is almost the same: + <p>For non-root Loggers the syntax is almost the same: <pre> - log4j.category.category_name=[INHERITED|FATAL|ERROR|WARN|INFO|DEBUG], appenderName, appenderName, ... + log4j.logger.logger_name=[INHERITED|FATAL|ERROR|WARN|INFO|DEBUG], appenderName, appenderName, ... </pre> <p>Thus, one of the usual priority values FATAL, ERROR, WARN, INFO, or DEBUG can be optionally specified. For any any of these - values the named category is assigned the corresponding + values the named Logger is assigned the corresponding priority. In addition however, the value INHERITED can be - optionally specified which means that named category should - inherit its priority from the category hierarchy. + optionally specified which means that named Logger should + inherit its priority from the Logger hierarchy. <p>If no priority value is supplied, then the priority of the - named category remains untouched. + named Logger remains untouched. - <p>By default categories inherit their priority from the - hierarchy. However, if you set the priority of a category and - later decide that that category should inherit its priority, then + <p>By default Loggers inherit their priority from the + hierarchy. However, if you set the priority of a Logger and + later decide that that Logger should inherit its priority, then you should specify INHERITED as the value for the priority value. - <p>Similar to the root category syntax, each <i>appenderName</i> - (seperated by commas) will be attached to the named category. + <p>Similar to the root Logger syntax, each <i>appenderName</i> + (seperated by commas) will be attached to the named Logger. <p>See the <a href="../../manual.html#additivity">appender additivity rule</a> in the user manual for the meaning of the @@ -142,7 +142,7 @@ <h3>Example</h3> <p>An example configuration is given below. Other configuration - file examples are given in [EMAIL PROTECTED] org.apache.log4j.examples.Sort} + file examples are given in {org.apache.log4j.examples.Sort} class documentation. <pre> @@ -158,7 +158,7 @@ # <b>%-4r %-5p %c{2} - %m%n</b>. Thus, the log output will # include the relative time since the start of the application in # milliseconds, followed by the priority of the log request, - # followed by the two rightmost components of the category name + # followed by the two rightmost components of the Logger name # and finally the message itself. # Refer to the documentation of [EMAIL PROTECTED] PatternLayout} for further information # on the syntax of the ConversionPattern key. @@ -174,24 +174,24 @@ log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%-4r %-5p %c - %m%n - # Root category set to DEBUG using the A2 appender defined above. - log4j.rootCategory=DEBUG, A2 + # Root Logger set to DEBUG using the A2 appender defined above. + log4j.rootLogger=DEBUG, A2 - # Category definions: - # The SECURITY category inherits is priority from root. However, it's output + # Logger definions: + # The SECURITY Logger inherits is priority from root. However, it's output # will go to A1 appender defined above. It's additivity is non-cumulative. - log4j.category.SECURITY=INHERIT, A1 + log4j.logger.SECURITY=INHERIT, A1 log4j.additivity.SECURITY=false - # Only warnings or above will be logged for the category "SECURITY.access". + # Only warnings or above will be logged for the Logger "SECURITY.access". # Output will go to A1. - log4j.category.SECURITY.access=WARN + log4j.logger.SECURITY.access=WARN - # The category "class.of.the.day" inherits its priority from the - # category hierrarchy. Output will go to the appender's of the root - # category, A2 in this case. - log4j.category.class.of.the.day=INHERIT + # The Logger "class.of.the.day" inherits its priority from the + # Logger hierarchy. Output will go to the appender's of the root + # Logger, A2 in this case. + log4j.logger.class.of.the.day=INHERIT </pre> <p>Refer to the <b>setOption</b> method in each Appender and @@ -229,7 +229,7 @@ public void configure(String configFilename) { new PropertyConfigurator().doConfigure(configFilename, - Category.defaultHierarchy); + Logger.defaultHierarchy); } /** @@ -240,7 +240,7 @@ public static void configure(java.net.URL configURL) { - new PropertyConfigurator().doConfigure(configURL, Category.defaultHierarchy); + new PropertyConfigurator().doConfigure(configURL, Logger.defaultHierarchy); } @@ -252,7 +252,7 @@ static public void configure(Properties properties) { - new PropertyConfigurator().doConfigure(properties, Category.defaultHierarchy); + new PropertyConfigurator().doConfigure(properties, Logger.defaultHierarchy); } /** @@ -268,7 +268,7 @@ LogLog.setInternalDebugging(OptionConverter.toBoolean(value, true)); } - configureRootCategory(properties, hierarchy); + configureRootLogger(properties, hierarchy); parseCats(properties, hierarchy); // We don't want to hold references to appenders preventing their @@ -322,14 +322,14 @@ } - void configureRootCategory(Properties props, Hierarchy hierarchy) { - String value = props.getProperty(ROOT_CATEGORY_PREFIX); + void configureRootLogger(Properties props, Hierarchy hierarchy) { + String value = props.getProperty(ROOT_LOGGER_PREFIX); if(value == null) - LogLog.debug("Could not find root category information. Is this OK?"); + LogLog.debug("Could not find root Logger information. Is this OK?"); else { - Category root = hierarchy.getRoot(); + Logger root = hierarchy.getRoot(); synchronized(root) { - parseCategory(props, root, ROOT_CATEGORY_PREFIX, INTERNAL_ROOT_NAME, + parseLogger(props, root, ROOT_LOGGER_PREFIX, INTERNAL_ROOT_NAME, value); } } @@ -337,36 +337,36 @@ /** - Parse non-root elements, such non-root categories and renderers. + Parse non-root elements, such non-root Loggers and renderers. */ protected void parseCats(Properties props, Hierarchy hierarchy) { Enumeration enumeration = props.propertyNames(); while(enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); - if(key.startsWith(CATEGORY_PREFIX)) { - String categoryName = key.substring(CATEGORY_PREFIX.length()); + if(key.startsWith(LOGGER_PREFIX)) { + String loggerName = key.substring(LOGGER_PREFIX.length()); String value = props.getProperty(key); - Category cat = hierarchy.getInstance(categoryName); + Logger cat = hierarchy.getInstance(loggerName); synchronized(cat) { - parseCategory(props, cat, key, categoryName, value); - parseAdditivityForCategory(props, cat, categoryName); + parseLogger(props, cat, key, loggerName, value); + parseAdditivityForLogger(props, cat, loggerName); } } } } /** - Parse the additivity option for a non-root category. + Parse the additivity option for a non-root Logger. */ - void parseAdditivityForCategory(Properties props, Category cat, - String categoryName) { - String value = props.getProperty(ADDITIVITY_PREFIX + categoryName); - LogLog.debug("Handling "+ADDITIVITY_PREFIX + categoryName+"=["+value+"]"); + void parseAdditivityForLogger(Properties props, Logger cat, + String loggerName) { + String value = props.getProperty(ADDITIVITY_PREFIX + loggerName); + LogLog.debug("Handling "+ADDITIVITY_PREFIX + loggerName+"=["+value+"]"); // touch additivity only if necessary if((value != null) && (!value.equals(""))) { boolean additivity = OptionConverter.toBoolean(value, true); - LogLog.debug("Setting additivity for \""+categoryName+"\" to "+ + LogLog.debug("Setting additivity for \""+loggerName+"\" to "+ additivity); cat.setAdditivity(additivity); } @@ -374,18 +374,18 @@ } /** - This method must work for the root category as well. + This method must work for the root Logger as well. */ - void parseCategory(Properties props, Category cat, String optionKey, - String catName, String value) { + void parseLogger(Properties props, Logger logger, String optionKey, + String logName, String value) { - LogLog.debug("Parsing for [" +catName +"] with value=[" + value+"]."); + LogLog.debug("Parsing for [" +logName +"] with value=[" + value+"]."); // We must skip over ',' but not white space StringTokenizer st = new StringTokenizer(value, ","); // If value is not in the form ", appender.." or "", then we should set - // the priority of the category. + // the priority of the Logger. if(!(value.startsWith(",") || value.equals(""))) { @@ -396,18 +396,18 @@ String priorityStr = st.nextToken(); LogLog.debug("Priority token is [" + priorityStr + "]."); - // If the priority value is inherited, set category priority value to + // If the priority value is inherited, set Logger priority value to // null. We also check that the user has not specified inherited for the - // root category. - if(priorityStr.equalsIgnoreCase(INHERITED) && !catName.equals(INTERNAL_ROOT_NAME)) - cat.setPriority(null); + // root Logger. + if(priorityStr.equalsIgnoreCase(INHERITED) && !logName.equals(INTERNAL_ROOT_NAME)) + logger.setPriority(null); else - cat.setPriority(Priority.toPriority(priorityStr)); - LogLog.debug("Category " + catName + " set to " + cat.getPriority()); + logger.setPriority(Priority.toPriority(priorityStr)); + LogLog.debug("Logger " + logName + " set to " + logger.getPriority()); } // Remove all existing appenders. They will be reconstructed below. - cat.removeAllAppenders(); + logger.removeAllAppenders(); Appender appender; String appenderName; @@ -418,7 +418,7 @@ LogLog.debug("Parsing appender named \"" + appenderName +"\"."); appender = parseAppender(props, appenderName); if(appender != null) { - cat.addAppender(appender); + logger.addAppender(appender); } } }
Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/ProvisionNode.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/ProvisionNode.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/ProvisionNode.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/ProvisionNode.java Wed Jan 18 09:05:18 2006 @@ -11,8 +11,8 @@ class ProvisionNode extends Vector { - ProvisionNode(Category cat) { + ProvisionNode(Logger logger) { super(); - this.addElement(cat); + this.addElement(logger); } } Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/StressCategory.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/StressCategory.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/StressCategory.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/StressCategory.java Wed Jan 18 09:05:18 2006 @@ -1,241 +0,0 @@ -/* - * 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.txt file. */ - -package org.apache.log4j; - - -import org.apache.log4j.Priority; -import org.apache.log4j.Category; -import java.util.Random; - -/* - Stress test the Category class. - -*/ - -class StressCategory { - - static Priority[] priority = new Priority[] {Priority.DEBUG, - Priority.INFO, - Priority.WARN, - Priority.ERROR, - Priority.FATAL}; - - static Priority defaultPriority = Category.getRoot().getPriority(); - - static int LENGTH; - static String[] names; - static Category[] cat; - static CT[] ct; - - static Random random = new Random(10); - - public static void main(String[] args) { - - LENGTH = args.length; - - if(LENGTH == 0) { - System.err.println( "Usage: java " + StressCategory.class.getName() + - " name1 ... nameN\n."); - System.exit(1); - } - if(LENGTH >= 7) { - System.err.println( - "This stress test suffers from combinatorial explosion.\n"+ - "Invoking with seven arguments takes about 90 minutes even on fast machines"); - } - - names = new String[LENGTH]; - for(int i=0; i < LENGTH; i++) { - names[i] = args[i]; - } - cat = new Category[LENGTH]; - ct = new CT[LENGTH]; - - - permute(0); - - // If did not exit, then passed all tests. - } - - // Loop through all permutations of names[]. - // On each possible permutation call createLoop - static - void permute(int n) { - if(n == LENGTH) - createLoop(0); - else - for(int i = n; i < LENGTH; i++) { - swap(names, n, i); - permute(n+1); - swap(names, n, i); - } - } - - static - void swap(String[] names, int i, int j) { - String t = names[i]; - names[i] = names[j]; - names[j] = t; - } - - public - static - void permutationDump() { - System.out.print("Current permutation is - "); - for(int i = 0; i < LENGTH; i++) { - System.out.print(names[i] + " "); - } - System.out.println(); - } - - - // Loop through all possible 3^n combinations of not instantiating, - // instantiating and setting/not setting a priority. - - static - void createLoop(int n) { - if(n == LENGTH) { - //System.out.println("..............Creating cat[]..........."); - for(int i = 0; i < LENGTH; i++) { - if(ct[i] == null) - cat[i] = null; - else { - cat[i] = Category.getInstance(ct[i].catstr); - cat[i].setPriority(ct[i].priority); - } - } - test(); - // Clear hash table for next round - Category.defaultHierarchy.clear(); - } - else { - ct[n] = null; - createLoop(n+1); - - ct[n] = new CT(names[n], null); - createLoop(n+1); - - int r = random.nextInt(); if(r < 0) r = -r; - ct[n] = new CT(names[n], priority[r%5]); - createLoop(n+1); - } - } - - - static - void test() { - //System.out.println("++++++++++++TEST called+++++++++++++"); - //permutationDump(); - //catDump(); - - for(int i = 0; i < LENGTH; i++) { - if(!checkCorrectness(i)) { - System.out.println("Failed stress test."); - permutationDump(); - - //Hierarchy._default.fullDump(); - ctDump(); - catDump(); - System.exit(1); - } - } - } - - static - void ctDump() { - for(int j = 0; j < LENGTH; j++) { - if(ct[j] != null) - System.out.println("ct [" + j + "] = ("+ct[j].catstr+"," + - ct[j].priority + ")"); - else - System.out.println("ct [" + j + "] = undefined"); - } - } - - static - void catDump() { - for(int j = 0; j < LENGTH; j++) { - if(cat[j] != null) - System.out.println("cat[" + j + "] = (" + cat[j].name + "," + - cat[j].getPriority() + ")"); - else - System.out.println("cat[" + j + "] = undefined"); - } - } - - // static - //void provisionNodesDump() { - //for (Enumeration e = CategoryFactory.ht.keys(); e.hasMoreElements() ;) { - // CategoryKey key = (CategoryKey) e.nextElement(); - // Object c = CategoryFactory.ht.get(key); - // if(c instanceof ProvisionNode) - //((ProvisionNode) c).dump(key.name); - //} - //} - - static - boolean checkCorrectness(int i) { - CT localCT = ct[i]; - - // Can't perform test if category is not instantiated - if(localCT == null) - return true; - - // find expected priority - Priority expected = getExpectedPrioriy(localCT); - - - Priority purported = cat[i].getChainedPriority(); - - if(expected != purported) { - System.out.println("Expected priority for " + localCT.catstr + " is " + - expected); - System.out.println("Purported priority for "+ cat[i].name + " is "+purported); - return false; - } - return true; - - } - - static - Priority getExpectedPrioriy(CT ctParam) { - Priority priority = ctParam.priority; - if(priority != null) - return priority; - - - String catstr = ctParam.catstr; - - for(int i = catstr.lastIndexOf('.', catstr.length()-1); i >= 0; - i = catstr.lastIndexOf('.', i-1)) { - String substr = catstr.substring(0, i); - - // find the priority of ct corresponding to substr - for(int j = 0; j < LENGTH; j++) { - if(ct[j] != null && substr.equals(ct[j].catstr)) { - Priority p = ct[j].priority; - if(p != null) - return p; - } - } - } - return defaultPriority; - } - - - - static class CT { - public String catstr; - public Priority priority; - - CT(String catstr, Priority priority) { - this.catstr = catstr; - this.priority = priority; - } - } -} Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/WriterAppender.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/WriterAppender.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/WriterAppender.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/WriterAppender.java Wed Jan 18 09:05:18 2006 @@ -23,12 +23,12 @@ [EMAIL PROTECTED] java.io.OutputStream} depending on the user's choice. @author Ceki Gülcü + * @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> @since 1.1 */ public class WriterAppender extends AppenderSkeleton { /** - This is the [EMAIL PROTECTED] QuietWriter quietWriter} where we will write - to. + This is where we will write to. */ protected Writer w; @@ -189,7 +189,7 @@ <p><b>WARNING:</b> Logging to an unopened Writer will fail. <p> - @param Writer An already opened Writer. */ + @param writer An already opened Writer. */ public synchronized void setWriter(Writer writer) { Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Sort.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Sort.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Sort.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Sort.java Wed Jan 18 09:05:18 2006 @@ -2,7 +2,7 @@ package org.apache.log4j.examples; import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.apache.log4j.Priority; /** @@ -31,7 +31,7 @@ public class Sort { - static Category CAT = Category.getInstance(Sort.class.getName()); + static Logger CAT = Logger.getInstance(Sort.class.getName()); public static void main(String[] args) { if(args.length != 2) { @@ -62,8 +62,9 @@ sa1.dump(); // We intentionally initilize sa2 with null. + CAT.info("We intentionally initilize sa2 with null."); SortAlgo sa2 = new SortAlgo(null); - CAT.info("The next log statement should be an error message."); + CAT.info("The next log statement should be an error message on console and in log."); sa2.dump(); CAT.info("Exiting main method."); } Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/SortAlgo.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/SortAlgo.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/SortAlgo.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/SortAlgo.java Wed Jan 18 09:05:18 2006 @@ -1,7 +1,7 @@ package org.apache.log4j.examples; -import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.apache.log4j.NDC; /** @@ -17,11 +17,11 @@ public class SortAlgo { final static String className = SortAlgo.class.getName(); - final static Category CAT = Category.getInstance(className); - final static Category OUTER = Category.getInstance(className + ".OUTER"); - final static Category INNER = Category.getInstance(className + ".INNER"); - final static Category DUMP = Category.getInstance(className + ".DUMP"); - final static Category SWAP = Category.getInstance(className + ".SWAP"); + final static Logger CAT = Logger.getInstance(className); + final static Logger OUTER = Logger.getInstance(className + ".OUTER"); + final static Logger INNER = Logger.getInstance(className + ".INNER"); + final static Logger DUMP = Logger.getInstance(className + ".DUMP"); + final static Logger SWAP = Logger.getInstance(className + ".SWAP"); int[] intArray; Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Trivial.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Trivial.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Trivial.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/Trivial.java Wed Jan 18 09:05:18 2006 @@ -2,8 +2,9 @@ package org.apache.log4j.examples; -import org.apache.log4j.Category; -import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; +//import org.apache.log4j.BasicConfigurator; import org.apache.log4j.NDC; /** @@ -34,10 +35,10 @@ */ public class Trivial { - static Category cat = Category.getInstance(Trivial.class.getName()); + static Logger cat = Logger.getInstance(Trivial.class.getName()); public static void main(String[] args) { - BasicConfigurator.configure(); + init(args[0]); NDC.push("Client #45890"); cat.info("Awake awake. Put on thy strength."); @@ -54,11 +55,17 @@ } static class InnerTrivial { - static Category cat = Category.getInstance(InnerTrivial.class.getName()); + static Logger cat = Logger.getInstance(InnerTrivial.class.getName()); static void foo() { cat.info("Entered foo."); } } + + static + void init(String configFile) { + PropertyConfigurator.configure(configFile); + } + } Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort1.lcf URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort1.lcf?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort1.lcf (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort1.lcf Wed Jan 18 09:05:18 2006 @@ -1,19 +1,19 @@ # An example log4j configuration file that outputs to System.out. # The output info consists of relative time, priority, thread name, -# category name, nested diagnostic context, the and the message in +# logger name, nested diagnostic context, the and the message in # that order. # For the general syntax of property based configuration files see the # documenation of org.apache.log4j.PropertyConfigurator. -# The root category uses the appender called A1. Since no priority is -# specified, the root category assumes the default priority for root -# which is DEBUG in log4j. The root category is the only category that +# The root logger uses the appender called A1. Since no priority is +# specified, the root logger assumes the default priority for root +# which is DEBUG in log4j. The root logger is the only logger that # has a default priority. All other categories do not have a default # priority. in which case the priority is inherited from the # hierarchy. -log4j.rootCategory=, A1 +log4j.rootLogger=, A1 # A1 is set to be a ConsoleAppender which outputs to System.out. log4j.appender.A1=org.apache.log4j.FileAppender @@ -24,9 +24,9 @@ # The conversion pattern uses format specifiers. You might want to # change the pattern an watch the output layout change. -log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n +log4j.appender.A1.layout.ConversionPattern=%d %-4r %-5p [%t] %37c - %m%n # In this example, we are not really interested in INNER loop or SWAP # messages. Try changing the priorities of these categories. -# log4j.category.org.apache.log4j.examples.SortAlgo.INNER=WARN -# log4j.category.org.apache.log4j.examples.SortAlgo.SWAP=WARN +# log4j.logger.org.apache.log4j.examples.SortAlgo.INNER=WARN +# log4j.logger.org.apache.log4j.examples.SortAlgo.SWAP=WARN Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort2.lcf URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort2.lcf?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort2.lcf (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort2.lcf Wed Jan 18 09:05:18 2006 @@ -1,7 +1,7 @@ # An example log4j configuration file that outputs both to System.out # and a file named 'test'. -log4j.rootCategory=, A1, A2 +log4j.rootLogger=, A1, A2 # A1 is set to be FileAppender sending its output to System.out log4j.appender.A1=org.apache.log4j.FileAppender @@ -12,12 +12,12 @@ log4j.appender.A1.layout=org.apache.log4j.PatternLayout # The conversion pattern consists of date in ISO8601 format, priority, -# thread name, category name truncated to its rightmost two components +# thread name, logger name truncated to its rightmost two components # and left justified to 17 characters, location information consisting # of file name (padded to 13 characters) and line number, nested # diagnostic context, the and the application supplied message -log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n +log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} - %m%n # Appender A2 writes to the file "test". log4j.appender.A2=org.apache.log4j.FileAppender @@ -35,5 +35,5 @@ # messages. You might try to set INNER and SWAP to DEBUG for more # verbose output. -log4j.category.org.apache.log4j.examples.SortAlgo.INNER=INFO -log4j.category.org.apache.log4j.examples.SortAlgo.SWAP=INFO +log4j.logger.org.apache.log4j.examples.SortAlgo.INNER=INFO +log4j.logger.org.apache.log4j.examples.SortAlgo.SWAP=INFO Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort3.lcf URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort3.lcf?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort3.lcf (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/examples/sort3.lcf Wed Jan 18 09:05:18 2006 @@ -1,5 +1,5 @@ # Attach appender A1 to root. Set root priority to Prority.DEBUG. -log4j.rootCategory=DEBUG, A1 +log4j.rootLogger=DEBUG, A1 @@ -8,7 +8,7 @@ # since the threshold is set to Priority.ERROR. # The fact that the root priority is set to Prority.DEBUG only -# influences log requests made to the root category. It has no +# influences log requests made to the root logger. It has no # influence on the appenders attached to root. log4j.appender.A1=org.apache.log4j.ConsoleAppender @@ -16,22 +16,22 @@ log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%p [%t] %c{2} (%M:%L) - %m%n +log4j.appender.A1.layout.ConversionPattern=%d %p [%t] %c{2} - %m%n -# Set the priority of the category named "org.apache.log4j.examples" to +# Set the priority of the logger named "org.apache.log4j.examples" to # Priority.INFO, attach appender A2. -log4j.category.org.apache.log4j.examples=INFO, A2 +log4j.logger.org.apache.log4j.examples=INFO, A2 # Appender A2 writes to the file "test" in user's home. log4j.appender.A2=org.apache.log4j.FileAppender -log4j.appender.A2.File=${user.home}/test +log4j.appender.A2.File=test.log # Truncate 'test' if it aleady exists. log4j.appender.A2.Append=false # Appender A2 uses the PatternLayout. log4j.appender.A2.layout=org.apache.log4j.PatternLayout -log4j.appender.A2.layout.ConversionPattern=%5r %-5p [%t] %c{2} - %m%n +log4j.appender.A2.layout.ConversionPattern=%D %5r %-5p [%t] %c{2} - %m%n Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/OptionConverter.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/OptionConverter.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/OptionConverter.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/OptionConverter.java Wed Jan 18 09:05:18 2006 @@ -25,6 +25,27 @@ } + /** + Very similar to <code>System.getProperty</code> except + that the [EMAIL PROTECTED] SecurityException} is hidden. + + @param key The key to search for. + @param def The default value to return. + @return the string value of the system property, or the default + value if there is no property with that key. + + @since 1.1 */ +public +static +String getSystemProperty(String key, String def) { + try { + return System.getProperty(key, def); + } catch(Throwable e) { // MS-Java throws com.ms.security.SecurityExceptionEx + LogLog.debug("Was not allowed to read system property \""+key+"\"."); + return def; + } +} + public static Object instantiateByKey(Properties props, String key, Class superClass, Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/PatternParser.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/PatternParser.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/PatternParser.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/helpers/PatternParser.java Wed Jan 18 09:05:18 2006 @@ -2,10 +2,9 @@ import org.apache.log4j.helpers.LogLog; import org.apache.log4j.Layout; -import org.apache.log4j.NDC; import org.apache.log4j.spi.LoggingEvent; -import java.text.DateFormat; -import java.util.Date; +import java.text.SimpleDateFormat; +import java.util.*; // Contributors: Nelson Minar <([EMAIL PROTECTED]> // Igor E. Poteryaev <[EMAIL PROTECTED]> @@ -18,6 +17,7 @@ @author <a href=mailto:"[EMAIL PROTECTED]">James P. Cakalic</a> @author Ceki Gülcü @author Anders Kristensen + * @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> @since 0.8.2 */ @@ -33,11 +33,13 @@ private static final int MAX_STATE = 5; - static final int RELATIVE_TIME_CONVERTER = 2000; - static final int THREAD_CONVERTER = 2001; - static final int PRIORITY_CONVERTER = 2002; + static final int RELATIVE_TIME_CONVERTER = 2000; // %r + static final int THREAD_CONVERTER = 2001; // %t + static final int PRIORITY_CONVERTER = 2002; // %p //static final int NDC_CONVERTER = 2003; - static final int MESSAGE_CONVERTER = 2004; + static final int MESSAGE_CONVERTER = 2004; // %m + static final int GMT_DATESTAMP_CONVERTER = MESSAGE_CONVERTER + 1; // %D + static final int LOCAL_DATESTAMP_CONVERTER = GMT_DATESTAMP_CONVERTER + 1; // %d int state; protected StringBuffer currentLiteral = new StringBuffer(32); @@ -204,12 +206,20 @@ PatternConverter pc = null; switch(c) { case 'c': - pc = new CategoryPatternConverter(formattingInfo, + pc = new LoggerPatternConverter(formattingInfo, extractPrecisionOption()); //LogLog.debug("CATEGORY converter."); //formattingInfo.dump(); currentLiteral.setLength(0); break; + case 'D': + pc = new BasicPatternConverter(formattingInfo, + GMT_DATESTAMP_CONVERTER); + break; + case 'd': + pc = new BasicPatternConverter(formattingInfo, + LOCAL_DATESTAMP_CONVERTER); + break; case 'm': pc = new BasicPatternConverter(formattingInfo, MESSAGE_CONVERTER); //LogLog.debug("MESSAGE converter."); @@ -279,25 +289,34 @@ private static class BasicPatternConverter extends PatternConverter { int type; + static String dateFormatStr = "yyyy.MM.dd HH:mm:ss zzz"; + static SimpleDateFormat gmtDateFormatter = new SimpleDateFormat(dateFormatStr); + static SimpleDateFormat localDateFormatter = new SimpleDateFormat(dateFormatStr); BasicPatternConverter(FormattingInfo formattingInfo, int type) { super(formattingInfo); this.type = type; + // Set GMT date formatter to display GMT time not local + gmtDateFormatter.setTimeZone(TimeZone.getTimeZone("GMT")); } public String convert(LoggingEvent event) { switch(type) { + case GMT_DATESTAMP_CONVERTER: + return gmtDateFormatter.format(new Date(event.timeStamp)); + case LOCAL_DATESTAMP_CONVERTER: + return localDateFormatter.format(new Date(event.timeStamp)); case RELATIVE_TIME_CONVERTER: - return (Long.toString(event.timeStamp - LoggingEvent.getStartTime())); + return (Long.toString(event.timeStamp - LoggingEvent.getStartTime())); case THREAD_CONVERTER: - return event.getThreadName(); + return event.getThreadName(); case PRIORITY_CONVERTER: - return event.priority.toString(); + return event.priority.toString(); //case NDC_CONVERTER: //return event.getNDC(); case MESSAGE_CONVERTER: { - return event.message; + return event.message; } default: return null; } @@ -323,10 +342,10 @@ } } - private static class CategoryPatternConverter extends PatternConverter { + private static class LoggerPatternConverter extends PatternConverter { int precision; - CategoryPatternConverter(FormattingInfo formattingInfo, int precision) { + LoggerPatternConverter(FormattingInfo formattingInfo, int precision) { super(formattingInfo); this.precision = precision; } @@ -337,7 +356,7 @@ public String convert(LoggingEvent event) { - String n = event.categoryName; + String n = event.loggerName; if(precision <= 0) return n; else { @@ -345,7 +364,7 @@ // We substract 1 from 'len' when assigning to 'end' to avoid out of // bounds exception in return r.substring(end+1, len). This can happen if - // precision is 1 and the category name ends with a dot. + // precision is 1 and the logger name ends with a dot. int end = len -1 ; for(int i = precision; i > 0; i--) { end = n.lastIndexOf('.', end-1); Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/LoggingEvent.java Wed Jan 18 09:05:18 2006 @@ -7,7 +7,7 @@ package org.apache.log4j.spi; -import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.apache.log4j.Priority; import org.apache.log4j.NDC; @@ -34,21 +34,22 @@ @author Ceki Gülcü @author James P. Cakalic + * @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> @since 0.8.2 */ public class LoggingEvent { private static long startTime = System.currentTimeMillis(); - /** The category of the logging event. The category field is not + /** The logger of the logging event. The logger field is not serialized for performance reasons. <p>It is set by the LoggingEvent constructor or set by a remote entity after deserialization. */ - transient public Category category; + transient public Logger logger; - /** The category name. */ - public final String categoryName; + /** The logger name. */ + public final String loggerName; /** Priority of logging event. Priority cannot be serializable because it is a flyweight. Due to its special seralization it @@ -94,14 +95,14 @@ <p>Except [EMAIL PROTECTED] #timeStamp} all the other fields of <code>LoggingEvent</code> are filled when actually needed. <p> - @param category The category of this event. + @param logger The logger 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 LoggingEvent(Category category, Priority priority, Object message, + public LoggingEvent(Logger logger, Priority priority, Object message, Throwable throwable) { - this.category = category; - this.categoryName = category.getName(); + this.logger = logger; + this.loggerName = logger.getName(); this.priority = priority; this.message = message.toString(); this.throwable = throwable; Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootCategory.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootCategory.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootCategory.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootCategory.java Wed Jan 18 09:05:18 2006 @@ -1,60 +0,0 @@ - -package org.apache.log4j.spi; - -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.apache.log4j.Priority; -import org.apache.log4j.helpers.LogLog; - - -/** - RootCategory sits at the top of the category hierachy. It is a - regular category except that it provides several guarantees. - - <p>First, it cannot be assigned a <code>null</code> - priority. Second, since root category cannot have a parent, the - [EMAIL PROTECTED] #getChainedPriority} method always returns the value of the - priority field without walking the hierarchy. - - @author Ceki Gülcü - - */ -final public class RootCategory extends Logger { - - /** - The root category names itself as "root". However, the root - category cannot be retrieved by name. - */ - public - RootCategory(Priority priority) { - super("root"); - setPriority(priority); - } - - - /** - Return the assigned priority value without walking the category - hierarchy. - */ - final - public - Priority getChainedPriority() { - return priority; - } - - /** - Setting a null value to the priority of the root category may have catastrophic - results. We prevent this here. - - @since 0.8.3 */ - final - public - void setPriority(Priority priority) { - if(priority == null) { - LogLog.error("null priority disallowed", new Throwable()); - } - else { - this.priority = priority; - } - } -} Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootLogger.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootLogger.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootLogger.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/spi/RootLogger.java Wed Jan 18 09:05:18 2006 @@ -7,21 +7,23 @@ /** - RootLogger sits at the top of the category hierachy. It is a - regular category except that it provides several guarantees. + RootLogger sits at the top of the Logger hierachy. It is a + regular Logger except that it provides several guarantees. <p>First, it cannot be assigned a <code>null</code> - priority. Second, since root category cannot have a parent, the + priority. Second, since root Logger cannot have a parent, the [EMAIL PROTECTED] #getChainedPriority} method always returns the value of the priority field without walking the hierarchy. + @author Ceki Gülcü + * @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> */ final public class RootLogger extends Logger { /** - The root logger names itself as "root". However, the root - category cannot be retrieved by name. + The root Logger names itself as "root". However, the root + Logger cannot be retrieved by name. */ public RootLogger(Priority priority) { @@ -31,7 +33,7 @@ /** - Return the assigned priority value without walking the category + Return the assigned priority value without walking the Logger hierarchy. */ final @@ -41,7 +43,7 @@ } /** - Setting a null value to the priority of the root category may have catastrophic + Setting a null value to the priority of the root Logger may have catastrophic results. We prevent this here. @since 0.8.3 */ Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/ConfigurationFileParsing.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/ConfigurationFileParsing.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/ConfigurationFileParsing.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/ConfigurationFileParsing.java Wed Jan 18 09:05:18 2006 @@ -8,11 +8,11 @@ package org.apache.log4j.test; import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.Category; +import org.apache.log4j.Logger; public class ConfigurationFileParsing { - static Category log = Category.getInstance(ConfigurationFileParsing.class); + static Logger log = Logger.getInstance(ConfigurationFileParsing.class); public static @@ -20,7 +20,7 @@ if(argv.length == 1) { PropertyConfigurator.configure(argv[0]); - Category root = Category.getRoot(); + Logger root = Logger.getRoot(); root.debug("Message 1"); log.info("Message 2"); Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Hello.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Hello.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Hello.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Hello.java Wed Jan 18 09:05:18 2006 @@ -13,24 +13,40 @@ /** Very simple log4j usage example. - @author Ceki Gülcü + @author Ceki Gülcü + @author <a href="mailto:[EMAIL PROTECTED]">Ralph Curtis</a> */ public class Hello { - static Category log = Category.getInstance(Hello.class); + static Logger log = Logger.getInstance(Hello.class); + /* Example of using two different loggers in same class. */ + static Logger consoleLogger = Logger.getInstance(Hello.class.getName()+" ConsoleLogger"); public static void main(String argv[]) { - Category root = Category.getRoot(); - Layout layout = new PatternLayout("%p [%t] %c - %m%n"); + Logger root = Logger.getRoot(); + Layout layout = new PatternLayout("%D %p [%t] %c - %m%n"); try { - root.addAppender(new FileAppender(layout, System.out)); +// root.addAppender(new FileAppender(layout, System.out)); +// root.addAppender(new ConsoleAppender(layout)); +// root.addAppender(new FileAppender(layout, "testlog.log")); + log.addAppender(new FileAppender(layout, "testlog.log")); +// consoleLogger.addAppender(new ConsoleAppender()); } catch(Exception e) { LogLog.warn("Could not open file appender."); } log.debug("Hello world."); log.info("What a beatiful day."); + int max = 100000; + consoleLogger.info("Writing "+max +" logs"); + long t1; + long t0 = System.currentTimeMillis(); + for(int i = 0; i < max; ++i) { + log.info("What a beautiful day."); + } + t1 = System.currentTimeMillis(); + consoleLogger.info("Test done. Logged: " +max +" logs in " +(t1-t0) +" msec"); } } Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Min.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Min.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Min.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Min.java Wed Jan 18 09:05:18 2006 @@ -6,7 +6,7 @@ import java.io.IOException; /** - This class tests the functionality of the Category class and the + This class tests the functionality of the Logger class and the different layouts. @author Ceki Gülcü @@ -44,7 +44,7 @@ try { Layout layout = new PatternLayout(format); Appender appender = new FileAppender(layout, System.out); - Category.getRoot().addAppender(appender); + Logger.getRoot().addAppender(appender); } catch(Exception e) { LogLog.error("Could not initialize log4j."); } @@ -56,23 +56,23 @@ int i = 0; - // In the lines below, the category names are chosen as an aid in - // remembering their priority values. In general, the category + // In the lines below, the logger names are chosen as an aid in + // remembering their priority values. In general, the logger // names should have no bearing to priority values. - Category ERR = Category.getInstance("ERR"); + Logger ERR = Logger.getInstance("ERR"); ERR.setPriority(Priority.ERROR); - Category INF = Category.getInstance("INF"); + Logger INF = Logger.getInstance("INF"); INF.setPriority(Priority.INFO); - Category INF_ERR = Category.getInstance("INF.ERR"); + Logger INF_ERR = Logger.getInstance("INF.ERR"); INF_ERR.setPriority(Priority.ERROR); - Category DEB = Category.getInstance("DEB"); + Logger DEB = Logger.getInstance("DEB"); DEB.setPriority(Priority.DEBUG); - // Note: categories with undefined priority - Category INF_UNDEF = Category.getInstance("INF.UNDEF"); - Category INF_ERR_UNDEF = Category.getInstance("INF.ERR.UNDEF"); - Category UNDEF = Category.getInstance("UNDEF"); + // Note: Loggers with undefined priority + Logger INF_UNDEF = Logger.getInstance("INF.UNDEF"); + Logger INF_ERR_UNDEF = Logger.getInstance("INF.ERR.UNDEF"); + Logger UNDEF = Logger.getInstance("UNDEF"); // These should all log.---------------------------- Modified: logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Shallow.java URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Shallow.java?rev=370187&r1=370186&r2=370187&view=diff ============================================================================== --- logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Shallow.java (original) +++ logging/sandbox/log4j/log4jMini/trunk/src/java/org/apache/log4j/test/Shallow.java Wed Jan 18 09:05:18 2006 @@ -12,7 +12,7 @@ */ public class Shallow { - static Category cat = Category.getInstance(Shallow.class); + static Logger cat = Logger.getInstance(Shallow.class); public static @@ -33,7 +33,7 @@ static void init(String file, String format) { - Category root = Category.getRoot(); + Logger root = Logger.getRoot(); Layout layout = new PatternLayout(format); try { root.addAppender(new FileAppender(layout, file)); @@ -46,7 +46,7 @@ void test() { int i = -1; - Category root = Category.getRoot(); + Logger root = Logger.getRoot(); cat.debug("Message " + ++i); root.debug("Message " + i); cat.info ("Message " + ++i); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
