Author: rgoers
Date: Sun Oct 14 22:10:54 2012
New Revision: 1398141
URL: http://svn.apache.org/viewvc?rev=1398141&view=rev
Log:
Added several missing classes and methods for Log4j 1.x compatibility.
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Appender.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Layout.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/PropertyConfigurator.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetter.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetterException.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/Filter.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerFactory.java
- copied, changed from r1397892,
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LoggerFactory.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerRepository.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggingEvent.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/RepositorySelector.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/DomConfigurator.java
Removed:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LoggerFactory.java
Modified:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Category.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LogManager.java
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Logger.java
logging/log4j/log4j2/trunk/src/changes/changes.xml
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Appender.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Appender.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Appender.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Appender.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,135 @@
+/*
+ * 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;
+
+import org.apache.log4j.spi.Filter;
+import org.apache.log4j.spi.ErrorHandler;
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ * Implement this interface for your own strategies for outputting log
+ * statements.
+ *
+ * @author Ceki Gülcü
+ */
+public interface Appender {
+
+ /**
+ * Add a filter to the end of the filter list.
+ *
+ * @since 0.9.0
+ */
+ void addFilter(Filter newFilter);
+
+ /**
+ * Returns the head Filter. The Filters are organized in a linked list
+ * and so all Filters on this Appender are available through the result.
+ *
+ * @return the head Filter or null, if no Filters are present
+ * @since 1.1
+ */
+ public Filter getFilter();
+
+ /**
+ * Clear the list of filters by removing all the filters in it.
+ *
+ * @since 0.9.0
+ */
+ public void clearFilters();
+
+ /**
+ * Release any resources allocated within the appender such as file
+ * handles, network connections, etc.
+ * <p/>
+ * <p>It is a programming error to append to a closed appender.
+ *
+ * @since 0.8.4
+ */
+ public void close();
+
+ /**
+ * Log in <code>Appender</code> specific way. When appropriate,
+ * Loggers will call the <code>doAppend</code> method of appender
+ * implementations in order to log.
+ */
+ public void doAppend(LoggingEvent event);
+
+
+ /**
+ * Get the name of this appender.
+ *
+ * @return name, may be null.
+ */
+ public String getName();
+
+
+ /**
+ * Set the {@link ErrorHandler} for this appender.
+ *
+ * @since 0.9.0
+ */
+ public void setErrorHandler(ErrorHandler errorHandler);
+
+ /**
+ * Returns the {@link ErrorHandler} for this appender.
+ *
+ * @since 1.1
+ */
+ public ErrorHandler getErrorHandler();
+
+ /**
+ * Set the {@link Layout} for this appender.
+ *
+ * @since 0.8.1
+ */
+ public void setLayout(Layout layout);
+
+ /**
+ * Returns this appenders layout.
+ *
+ * @since 1.1
+ */
+ public Layout getLayout();
+
+
+ /**
+ * Set the name of this appender. The name is used by other
+ * components to identify this appender.
+ *
+ * @since 0.8.1
+ */
+ public void setName(String name);
+
+ /**
+ * Configurators call this method to determine if the appender
+ * requires a layout. If this method returns <code>true</code>,
+ * meaning that layout is required, then the configurator will
+ * configure an layout using the configuration information at its
+ * disposal. If this method returns <code>false</code>, meaning that
+ * a layout is not required, then layout configuration will be
+ * skipped even if there is available layout configuration
+ * information at the disposal of the configurator..
+ * <p/>
+ * <p>In the rather exceptional case, where the appender
+ * implementation admits a layout but can also work without it, then
+ * the appender should return <code>true</code>.
+ *
+ * @since 0.8.4
+ */
+ public boolean requiresLayout();
+}
+
Modified:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java?rev=1398141&r1=1398140&r2=1398141&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
(original)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/BasicConfigurator.java
Sun Oct 14 22:10:54 2012
@@ -24,11 +24,22 @@ public class BasicConfigurator {
protected BasicConfigurator() {
}
+ /**
+ * No-op implementation.
+ */
public static void configure() {
LogManager.reconfigure();
}
+ /**
+ * No-op implementation.
+ */
+ public static void configure(Appender appender) {
+ }
+
+ /**
+ * No-op implementation.
+ */
public static void resetConfiguration() {
- LogManager.reconfigure();
}
}
Modified:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Category.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Category.java?rev=1398141&r1=1398140&r2=1398141&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Category.java
(original)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Category.java
Sun Oct 14 22:10:54 2012
@@ -16,12 +16,16 @@
*/
package org.apache.log4j;
+import org.apache.log4j.helpers.NullEnumeration;
+import org.apache.log4j.spi.LoggerFactory;
+import org.apache.log4j.spi.LoggingEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.helpers.NameUtil;
import org.apache.logging.log4j.message.LocalizedMessage;
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.message.ObjectMessage;
+import java.util.Enumeration;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.WeakHashMap;
@@ -34,7 +38,7 @@ import java.util.concurrent.ConcurrentMa
*/
public class Category {
- private static org.apache.log4j.LoggerFactory loggerFactory = new
PrivateFactory();
+ private static LoggerFactory loggerFactory = new PrivateFactory();
private static final Map<LoggerContext, ConcurrentMap<String, Logger>>
CONTEXT_MAP =
new WeakHashMap<LoggerContext, ConcurrentMap<String, Logger>>();
@@ -77,7 +81,7 @@ public class Category {
return getInstance(context, name, loggerFactory);
}
- static Category getInstance(LoggerContext context, String name,
org.apache.log4j.LoggerFactory factory) {
+ static Category getInstance(LoggerContext context, String name,
LoggerFactory factory) {
ConcurrentMap<String, Logger> loggers = getLoggersMap(context);
Logger logger = loggers.get(name);
if (logger != null) {
@@ -134,6 +138,19 @@ public class Category {
}
}
+ /**
+ Returns all the currently defined categories in the default
+ hierarchy as an {@link java.util.Enumeration Enumeration}.
+
+ <p>The root category is <em>not</em> included in the returned
+ {@link Enumeration}.
+
+ @deprecated Please use {@link LogManager#getCurrentLoggers()} instead.
+ */
+ public static Enumeration getCurrentCategories() {
+ return LogManager.getCurrentLoggers();
+ }
+
public final Level getEffectiveLevel() {
org.apache.logging.log4j.Level level = logger.getLevel();
@@ -248,6 +265,68 @@ public class Category {
return isEnabledFor(lvl);
}
+ /**
+ * No-op implementation.
+ * @param appender The Appender to add.
+ */
+ public void addAppender(Appender appender) {
+ }
+
+ /**
+ * No-op implementation.
+ * @param event The logging event.
+ */
+ public void callAppenders(LoggingEvent event) {
+ }
+
+ public Enumeration getAllAppenders() {
+ return NullEnumeration.getInstance();
+ }
+
+ /**
+ * No-op implementation.
+ * @param name The name of the Appender.
+ * @return null.
+ */
+ public Appender getAppender(String name) {
+ return null;
+ }
+
+ /**
+ Is the appender passed as parameter attached to this category?
+ @param appender The Appender to add.
+ */
+ public boolean isAttached(Appender appender) {
+ return false;
+ }
+
+ /**
+ * No-op implementation.
+ */
+ public void removeAllAppenders() {
+ }
+
+ /**
+ * No-op implementation.
+ * @param appender The Appender to remove.
+ */
+ public void removeAppender(Appender appender) {
+ }
+
+ /**
+ * No-op implementation.
+ * @param name The Appender to remove.
+ */
+ public void removeAppender(String name) {
+ }
+
+ /**
+ * No-op implementation.
+ */
+ public static void shutdown() {
+ }
+
+
public void forcedLog(String fqcn, Priority level, Object message,
Throwable t) {
org.apache.logging.log4j.Level lvl =
org.apache.logging.log4j.Level.toLevel(level.toString());
Message msg = message instanceof Message ? (Message) message : new
ObjectMessage(message);
@@ -288,6 +367,26 @@ public class Category {
return null;
}
+ /**
+ If <code>assertion</code> parameter is <code>false</code>, then
+ logs <code>msg</code> as an {@link #error(Object) error} statement.
+
+ <p>The <code>assert</code> method has been renamed to
+ <code>assertLog</code> because <code>assert</code> is a language
+ reserved word in JDK 1.4.
+
+ @param assertion The assertion.
+ @param msg The message to print if <code>assertion</code> is
+ false.
+
+ @since 1.2
+ */
+ public void assertLog(boolean assertion, String msg) {
+ if (!assertion) {
+ this.error(msg);
+ }
+ }
+
public void l7dlog(Priority priority, String key, Throwable t) {
if (isEnabledFor(priority)) {
Message msg = new LocalizedMessage(bundle, key, null);
@@ -333,7 +432,7 @@ public class Category {
/**
* Private logger factory.
*/
- private static class PrivateFactory implements
org.apache.log4j.LoggerFactory {
+ private static class PrivateFactory implements LoggerFactory {
public Logger makeNewLoggerInstance(LoggerContext context, String
name) {
return new Logger(context, name);
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Layout.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Layout.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Layout.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Layout.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ *
+ */
+public abstract class Layout {
+
+ // Note that the line.separator property can be looked up even by
+ // applets.
+ public final static String LINE_SEP = System.getProperty("line.separator");
+ public final static int LINE_SEP_LEN = LINE_SEP.length();
+
+
+ /**
+ * Implement this method to create your own layout format.
+ */
+ abstract public String format(LoggingEvent event);
+
+ /**
+ * Returns the content type output by this layout. The base class
+ * returns "text/plain".
+ */
+ public String getContentType() {
+ return "text/plain";
+ }
+
+ /**
+ * Returns the header for the layout format. The base class returns
+ * <code>null</code>.
+ */
+ public String getHeader() {
+ return null;
+ }
+
+ /**
+ * Returns the footer for the layout format. The base class returns
+ * <code>null</code>.
+ */
+ public String getFooter() {
+ return null;
+ }
+
+
+ /**
+ * If the layout handles the throwable object contained within
+ * {@link LoggingEvent}, then the layout should return
+ * <code>false</code>. Otherwise, if the layout ignores throwable
+ * object, then the layout should return <code>true</code>.
+ * If ignoresThrowable is true, the appender is responsible for
+ * rendering the throwable.
+ * <p/>
+ * <p>The {@link SimpleLayout}, {@link TTCCLayout}, {@link
+ * PatternLayout} all return <code>true</code>. The {@link
+ * org.apache.log4j.xml.XMLLayout} returns <code>false</code>.
+ *
+ * @since 0.8.4
+ */
+ abstract public boolean ignoresThrowable();
+}
+
Modified:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LogManager.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LogManager.java?rev=1398141&r1=1398140&r2=1398141&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LogManager.java
(original)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LogManager.java
Sun Oct 14 22:10:54 2012
@@ -16,13 +16,48 @@
*/
package org.apache.log4j;
+import org.apache.log4j.helpers.NullEnumeration;
+import org.apache.log4j.spi.HierarchyEventListener;
+import org.apache.log4j.spi.LoggerFactory;
+import org.apache.log4j.spi.LoggerRepository;
+import org.apache.log4j.spi.RepositorySelector;
import org.apache.logging.log4j.core.LoggerContext;
+import java.util.Enumeration;
+
/**
*
*/
public final class LogManager {
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become package protected in future versions.
+ * */
+ public static final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
+
+ static final String DEFAULT_XML_CONFIGURATION_FILE = "log4j.xml";
+
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ * */
+ public static final String DEFAULT_CONFIGURATION_KEY="log4j.configuration";
+
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ * */
+ public static final String
CONFIGURATOR_CLASS_KEY="log4j.configuratorClass";
+
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ */
+ public static final String DEFAULT_INIT_OVERRIDE_KEY =
"log4j.defaultInitOverride";
+
+ private static final LoggerRepository REPOSITORY = new Repository();
+
private LogManager() {
}
@@ -38,6 +73,10 @@ public final class LogManager {
return (Logger) Category.getInstance((LoggerContext)
PrivateManager.getContext(), clazz.getName());
}
+ public static Logger getLogger(final String name, final LoggerFactory
factory) {
+ return (Logger) Category.getInstance((LoggerContext)
PrivateManager.getContext(), name);
+ }
+
public static Logger exists(String name) {
LoggerContext ctx = (LoggerContext) PrivateManager.getContext();
if (!ctx.hasLogger(name)) {
@@ -46,12 +85,101 @@ public final class LogManager {
return Logger.getLogger(name);
}
+ public static Enumeration getCurrentLoggers() {
+ return NullEnumeration.getInstance();
+ }
+
static void reconfigure() {
LoggerContext ctx = (LoggerContext) PrivateManager.getContext();
ctx.reconfigure();
}
/**
+ * No-op implementation.
+ */
+ public static void shutdown() {
+ }
+
+ /**
+ * No-op implementation.
+ */
+ public static void resetConfiguration() {
+ }
+
+ /**
+ * No-op implementation.
+ * @param selector The RepositorySelector.
+ * @param guard prevents calls at the incorrect time.
+ * @throws IllegalArgumentException
+ */
+ public static void setRepositorySelector(RepositorySelector selector,
Object guard)
+ throws IllegalArgumentException {
+ }
+
+ public static LoggerRepository getLoggerRepository() {
+ return REPOSITORY;
+ }
+
+ private static class Repository implements LoggerRepository {
+ public void addHierarchyEventListener(HierarchyEventListener listener)
{
+
+ }
+
+ public boolean isDisabled(int level) {
+ return false;
+ }
+
+ public void setThreshold(Level level) {
+
+ }
+
+ public void setThreshold(String val) {
+
+ }
+
+ public void emitNoAppenderWarning(Category cat) {
+
+ }
+
+ public Level getThreshold() {
+ return Level.OFF;
+ }
+
+ public Logger getLogger(String name) {
+ return (Logger) Category.getInstance((LoggerContext)
PrivateManager.getContext(), name);
+ }
+
+ public Logger getLogger(String name, LoggerFactory factory) {
+ return (Logger) Category.getInstance((LoggerContext)
PrivateManager.getContext(), name);
+ }
+
+ public Logger getRootLogger() {
+ return (Logger) Category.getRoot((LoggerContext)
PrivateManager.getContext());
+ }
+
+ public Logger exists(String name) {
+ return LogManager.exists(name);
+ }
+
+ public void shutdown() {
+ }
+
+ public Enumeration getCurrentLoggers() {
+ return NullEnumeration.getInstance();
+ }
+
+ public Enumeration getCurrentCategories() {
+ return NullEnumeration.getInstance();
+ }
+
+ public void fireAddAppenderEvent(Category logger, Appender appender) {
+ }
+
+ public void resetConfiguration() {
+ }
+ }
+
+ /**
* Internal LogManager.
*/
private static class PrivateManager extends
org.apache.logging.log4j.LogManager {
Modified:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Logger.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Logger.java?rev=1398141&r1=1398140&r2=1398141&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Logger.java
(original)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/Logger.java
Sun Oct 14 22:10:54 2012
@@ -17,6 +17,7 @@
package org.apache.log4j;
+import org.apache.log4j.spi.LoggerFactory;
import org.apache.logging.log4j.core.LoggerContext;
/**
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/PropertyConfigurator.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/PropertyConfigurator.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/PropertyConfigurator.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/PropertyConfigurator.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,111 @@
+/*
+ * 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;
+
+import org.apache.log4j.spi.LoggerRepository;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ *
+ * @since 0.8.1
+ */
+public class PropertyConfigurator {
+
+ public void doConfigure(String configFileName, LoggerRepository hierarchy)
{
+
+ }
+
+ public static void configure(String configFileName) {
+ }
+
+ /**
+ Read configuration options from url <code>configURL</code>.
+
+ @since 0.8.2
+ */
+ public static void configure(URL configURL) {
+ }
+
+ /**
+ Reads configuration options from an InputStream.
+
+ @since 1.2.17
+ */
+ public static void configure(InputStream inputStream) {
+ }
+
+
+ /**
+ Read configuration options from <code>properties</code>.
+
+ See {@link #doConfigure(String, LoggerRepository)} for the expected
format.
+ */
+ public static void configure(Properties properties) {
+ }
+
+ /**
+ Like {@link #configureAndWatch(String, long)} except that the
+ default delay as defined by FileWatchdog.DEFAULT_DELAY is
+ used.
+
+ @param configFilename A file in key=value format.
+
+ */
+ public static void configureAndWatch(String configFilename) {
+ }
+
+
+ /**
+ Read the configuration file <code>configFilename</code> if it
+ exists. Moreover, a thread will be created that will periodically
+ check if <code>configFilename</code> has been created or
+ modified. The period is determined by the <code>delay</code>
+ argument. If a change or file creation is detected, then
+ <code>configFilename</code> is read to configure log4j.
+
+ @param configFilename A file in key=value format.
+ @param delay The delay in milliseconds to wait between each check.
+ */
+ public static void configureAndWatch(String configFilename, long delay) {
+ }
+
+
+ /**
+ Read configuration options from <code>properties</code>.
+
+ See {@link #doConfigure(String, LoggerRepository)} for the expected
format.
+ */
+ public void doConfigure(Properties properties, LoggerRepository hierarchy)
{
+ }
+
+ /**
+ * Read configuration options from an InputStream.
+ *
+ * @since 1.2.17
+ */
+ public void doConfigure(InputStream inputStream, LoggerRepository
hierarchy) {
+ }
+
+ /**
+ Read configuration options from url <code>configURL</code>.
+ */
+ public void doConfigure(java.net.URL configURL, LoggerRepository
hierarchy) {
+ }
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetter.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetter.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetter.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,86 @@
+/*
+ * 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.config;
+
+import java.beans.PropertyDescriptor;
+import java.util.Properties;
+
+/**
+ *
+ * @since 1.1
+ */
+public class PropertySetter {
+
+ /**
+ * Create a new PropertySetter for the specified Object. This is done
+ * in prepartion for invoking {@link #setProperty} one or more times.
+ *
+ * @param obj the object for which to set properties
+ */
+ public PropertySetter(Object obj) {
+ }
+
+ /**
+ Set the properties of an object passed as a parameter in one
+ go. The <code>properties</code> are parsed relative to a
+ <code>prefix</code>.
+
+ @param obj The object to configure.
+ @param properties A java.util.Properties containing keys and values.
+ @param prefix Only keys having the specified prefix will be set.
+ */
+ public static void setProperties(Object obj, Properties properties, String
prefix) {
+ }
+
+
+ /**
+ * Set the properites for the object that match the <code>prefix</code>
passed as parameter.
+ */
+ public void setProperties(Properties properties, String prefix) {
+ }
+
+ /**
+ Set a property on this PropertySetter's Object. If successful, this
+ method will invoke a setter method on the underlying Object. The
+ setter is the one for the specified property name and the value is
+ determined partly from the setter argument type and partly from the
+ value specified in the call to this method.
+
+ <p>If the setter expects a String no conversion is necessary.
+ If it expects an int, then an attempt is made to convert 'value'
+ to an int using new Integer(value). If the setter expects a boolean,
+ the conversion is by new Boolean(value).
+
+ @param name name of the property
+ @param value String value of the property
+ */
+ public void setProperty(String name, String value) {
+ }
+
+ /**
+ Set the named property given a {@link PropertyDescriptor}.
+
+ @param prop A PropertyDescriptor describing the characteristics
+ of the property to set.
+ @param name The named of the property to set.
+ @param value The value of the property.
+ */
+ public void setProperty(PropertyDescriptor prop, String name, String value)
+ throws PropertySetterException {
+ }
+
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetterException.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetterException.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetterException.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/config/PropertySetterException.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.config;
+
+/**
+ * Thrown when an error is encountered whilst attempting to set a property
+ * using the {@link PropertySetter} utility class.
+ *
+ * @since 1.1
+ */
+public class PropertySetterException extends Exception {
+ private static final long serialVersionUID = -1352613734254235861L;
+ protected Throwable rootCause;
+
+ public PropertySetterException(String msg) {
+ super(msg);
+ }
+
+ public PropertySetterException(Throwable rootCause) {
+ super();
+ this.rootCause = rootCause;
+ }
+
+ /**
+ * Returns descriptive text on the cause of this exception.
+ */
+ public String getMessage() {
+ String msg = super.getMessage();
+ if (msg == null && rootCause != null) {
+ msg = rootCause.getMessage();
+ }
+ return msg;
+ }
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/NullEnumeration.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/helpers/NullEnumeration.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,44 @@
+/*
+ * 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.helpers;
+
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * An always-empty Enumerator.
+ *
+ * @since version 1.0
+ */
+public class NullEnumeration implements Enumeration {
+ private static final NullEnumeration instance = new NullEnumeration();
+
+ private NullEnumeration() {
+ }
+
+ public static NullEnumeration getInstance() {
+ return instance;
+ }
+
+ public boolean hasMoreElements() {
+ return false;
+ }
+
+ public Object nextElement() {
+ throw new NoSuchElementException();
+ }
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/ErrorHandler.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,91 @@
+/*
+ * 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.spi;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+
+
+/**
+ * Appenders may delegate their error handling to
+ * <code>ErrorHandlers</code>.
+ * <p/>
+ * <p>Error handling is a particularly tedious to get right because by
+ * definition errors are hard to predict and to reproduce.
+ * <p/>
+ * <p/>
+ * <p>Please take the time to contact the author in case you discover
+ * that errors are not properly handled. You are most welcome to
+ * suggest new error handling policies or criticize existing policies.
+ *
+ * @author Ceki Gülcü
+ */
+public interface ErrorHandler {
+
+ /**
+ * Add a reference to a logger to which the failing appender might
+ * be attached to. The failing appender will be searched and
+ * replaced only in the loggers you add through this method.
+ *
+ * @param logger One of the loggers that will be searched for the failing
+ * appender in view of replacement.
+ * @since 1.2
+ */
+ void setLogger(Logger logger);
+
+
+ /**
+ * Equivalent to the {@link #error(String, Exception, int,
+ * LoggingEvent event)} with the the event parameteter set to
+ * <code>null</code>.
+ */
+ void error(String message, Exception e, int errorCode);
+
+ /**
+ * This method is normally used to just print the error message
+ * passed as a parameter.
+ */
+ void error(String message);
+
+ /**
+ * This method is invoked to handle the error.
+ *
+ * @param message The message assoicated with the error.
+ * @param e The Exption that was thrown when the error occured.
+ * @param errorCode The error code associated with the error.
+ * @param event The logging event that the failing appender is asked
+ * to log.
+ * @since 1.2
+ */
+ void error(String message, Exception e, int errorCode, LoggingEvent event);
+
+ /**
+ * Set the appender for which errors are handled. This method is
+ * usually called when the error handler is configured.
+ *
+ * @since 1.2
+ */
+ void setAppender(Appender appender);
+
+ /**
+ * Set the appender to falkback upon in case of failure.
+ *
+ * @since 1.2
+ */
+ void setBackupAppender(Appender appender);
+}
+
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/Filter.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/Filter.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/Filter.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/Filter.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,84 @@
+/*
+ * 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.spi;
+
+/**
+ * @since 0.9.0
+ */
+public abstract class Filter {
+
+ /**
+ * Points to the next filter in the filter chain.
+ *
+ * @deprecated As of 1.2.12, use {@link #getNext} and {@link #setNext}
instead
+ */
+ public Filter next;
+
+ /**
+ * The log event must be dropped immediately without consulting
+ * with the remaining filters, if any, in the chain.
+ */
+ public static final int DENY = -1;
+
+ /**
+ * This filter is neutral with respect to the log event. The
+ * remaining filters, if any, should be consulted for a final decision.
+ */
+ public static final int NEUTRAL = 0;
+
+ /**
+ * The log event must be logged immediately without consulting with
+ * the remaining filters, if any, in the chain.
+ */
+ public static final int ACCEPT = 1;
+
+
+ /**
+ * Usually filters options become active when set. We provide a
+ * default do-nothing implementation for convenience.
+ */
+ public void activateOptions() {
+ }
+
+
+ /**
+ * <p>If the decision is <code>DENY</code>, then the event will be
+ * dropped. If the decision is <code>NEUTRAL</code>, then the next
+ * filter, if any, will be invoked. If the decision is ACCEPT then
+ * the event will be logged without consulting with other filters in
+ * the chain.
+ *
+ * @param event The LoggingEvent to decide upon.
+ * @return decision The decision of the filter.
+ */
+ abstract public int decide(LoggingEvent event);
+
+ /**
+ * Set the next filter pointer.
+ */
+ public void setNext(Filter next) {
+ this.next = next;
+ }
+
+ /**
+ * Return the pointer to the next filter;
+ */
+ public Filter getNext() {
+ return next;
+ }
+
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,33 @@
+/*
+ * 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.spi;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.Category;
+
+/**
+ Listen to events occuring within a Hierarchy.
+
+ @since 1.2
+
+ */
+public interface HierarchyEventListener {
+
+ void addAppenderEvent(Category cat, Appender appender);
+
+ void removeAppenderEvent(Category cat, Appender appender);
+}
Copied:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerFactory.java
(from r1397892,
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LoggerFactory.java)
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerFactory.java?p2=logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerFactory.java&p1=logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LoggerFactory.java&r1=1397892&r2=1398141&rev=1398141&view=diff
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/LoggerFactory.java
(original)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerFactory.java
Sun Oct 14 22:10:54 2012
@@ -14,7 +14,10 @@
* See the license for the specific language governing permissions and
* limitations under the license.
*/
-package org.apache.log4j;
+package org.apache.log4j.spi;
+
+import org.apache.log4j.Logger;
+
/**
*
* Implement this interface to create new instances of Logger or
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerRepository.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerRepository.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerRepository.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggerRepository.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,96 @@
+/*
+ * 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.spi;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.Category;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+import java.util.Enumeration;
+
+/**
+ * A <code>LoggerRepository</code> is used to create and retrieve
+ * <code>Loggers</code>. The relation between loggers in a repository
+ * depends on the repository but typically loggers are arranged in a
+ * named hierarchy.
+ * <p/>
+ * <p>In addition to the creational methods, a
+ * <code>LoggerRepository</code> can be queried for existing loggers,
+ * can act as a point of registry for events related to loggers.
+ *
+ * @since 1.2
+ */
+public interface LoggerRepository {
+
+ /**
+ * Add a {@link HierarchyEventListener} event to the repository.
+ */
+ public void addHierarchyEventListener(HierarchyEventListener listener);
+
+ /**
+ * Returns whether this repository is disabled for a given
+ * level. The answer depends on the repository threshold and the
+ * <code>level</code> parameter. See also {@link #setThreshold}
+ * method.
+ */
+ boolean isDisabled(int level);
+
+ /**
+ * Set the repository-wide threshold. All logging requests below the
+ * threshold are immediately dropped. By default, the threshold is
+ * set to <code>Level.ALL</code> which has the lowest possible rank.
+ */
+ public void setThreshold(Level level);
+
+ /**
+ * Another form of {@link #setThreshold(Level)} accepting a string
+ * parameter instead of a <code>Level</code>.
+ */
+ public void setThreshold(String val);
+
+ public void emitNoAppenderWarning(Category cat);
+
+ /**
+ * Get the repository-wide threshold. See {@link
+ * #setThreshold(Level)} for an explanation.
+ */
+ public Level getThreshold();
+
+ public Logger getLogger(String name);
+
+ public Logger getLogger(String name, LoggerFactory factory);
+
+ public Logger getRootLogger();
+
+ public abstract Logger exists(String name);
+
+ public abstract void shutdown();
+
+ public Enumeration getCurrentLoggers();
+
+ /**
+ * Deprecated. Please use {@link #getCurrentLoggers} instead.
+ */
+ public Enumeration getCurrentCategories();
+
+
+ public abstract void fireAddAppenderEvent(Category logger, Appender
appender);
+
+ public abstract void resetConfiguration();
+
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggingEvent.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggingEvent.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggingEvent.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/LoggingEvent.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,23 @@
+/*
+ * 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.spi;
+
+/**
+ * No-op version of Log4j 1.2 LoggingEvent.
+ */
+public class LoggingEvent {
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/RepositorySelector.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/RepositorySelector.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/RepositorySelector.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/spi/RepositorySelector.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,44 @@
+/*
+ * 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.spi;
+
+import org.apache.log4j.spi.LoggerRepository;
+
+/**
+
+ The <code>LogManager</code> uses one (and only one)
+ <code>RepositorySelector</code> implementation to select the
+ {@link org.apache.log4j.spi.LoggerRepository} for a particular application
context.
+
+ <p>It is the responsability of the <code>RepositorySelector</code>
+ implementation to track the application context. Log4j makes no
+ assumptions about the application context or on its management.
+
+ <p>See also {@link org.apache.log4j.LogManager LogManager}.
+
+ @since 1.2
+
+ */
+public interface RepositorySelector {
+
+ /**
+ Returns a {@link org.apache.log4j.spi.LoggerRepository} depending on the
+ context. Implementors must make sure that a valid (non-null)
+ LoggerRepository is returned.
+ */
+ public LoggerRepository getLoggerRepository();
+}
Added:
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/DomConfigurator.java
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/DomConfigurator.java?rev=1398141&view=auto
==============================================================================
---
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/DomConfigurator.java
(added)
+++
logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/xml/DomConfigurator.java
Sun Oct 14 22:10:54 2012
@@ -0,0 +1,78 @@
+/*
+ * 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.xml;
+
+import org.apache.log4j.config.PropertySetter;
+import org.apache.log4j.spi.LoggerRepository;
+import org.w3c.dom.Element;
+
+import javax.xml.parsers.FactoryConfigurationError;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ *
+ */
+public class DomConfigurator {
+
+ public static void configure(Element element) {
+ }
+
+ public static void configureAndWatch(String configFilename) {
+ }
+
+ public static void configureAndWatch(String configFilename, long delay) {
+ }
+
+ public void doConfigure(final String filename, LoggerRepository
repository) {
+ }
+
+ public void doConfigure(final URL url, LoggerRepository repository) {
+ }
+
+ public void doConfigure(final InputStream inputStream, LoggerRepository
repository)
+ throws FactoryConfigurationError {
+ }
+
+ public void doConfigure(final Reader reader, LoggerRepository repository)
+ throws FactoryConfigurationError {
+ }
+
+ public void doConfigure(Element element, LoggerRepository repository) {
+ }
+
+ public static void configure(String filename) throws
FactoryConfigurationError {
+ }
+
+ public static void configure(URL url) throws FactoryConfigurationError {
+ }
+
+ public static String subst(final String value, final Properties props) {
+ return value;
+ }
+
+ public static void setParameter(final Element elem, final PropertySetter
propSetter, final Properties props) {
+
+ }
+
+ public static Object parseElement(final Element element,final Properties
props, final Class expectedClass)
+ throws Exception {
+ return null;
+ }
+}
Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1398141&r1=1398140&r2=1398141&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sun Oct 14 22:10:54 2012
@@ -23,6 +23,9 @@
<body>
<release version="2.0-beta3" date="TBD" description= "Bug fixes and
enhancements">
+ <action issue="LOG4J2-97" dev="rgoers" type="fix">
+ Added several missing classes and methods for Log4j 1.x compatibility.
+ </action>
<action issue="LOG4J2-94" dev="rgoers" type="fix" due-to="Denis
Treskunov">
Interpolator was not stripping Lookup key separator when trying to
locate the default value for a variable.
</action>