Bug 35452 - 1.3 alpha 7 not compatible with older versions of log4j i.e 1.2.8
Summary: 1.3 alpha 7 not compatible with older versions of log4j i.e 1.2.8
Status: RESOLVED WONTFIX
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.3alpha
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
: 37735 (view as bug list)
Depends on: 37965 38024 39023 39024
Blocks:
  Show dependency tree
 
Reported: 2005-06-21 19:59 UTC by Steven McArdle
Modified: 2007-08-22 16:06 UTC (History)
1 user (show)



Attachments
Proposed patch to one major source of this issue (hoisted from bug #35452) (8.52 KB, patch)
2005-12-01 17:43 UTC, Jess Holle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven McArdle 2005-06-21 19:59:03 UTC
While trying to upgrade to 1.3alpha I get exceptions generated due to the 
Priority class not having a DEBUG field when called from the commons-logging 
jar file.

I notice on decompilation that the Priority class now extends the Level class. 
This means that when I try to call a DEBUG level (or any other probably) I get 
the following error generated in my tomcat loggs (this is from an axis service)

2005-06-21 19:46:21 StandardWrapperValve[AxisServlet]: Servlet.service() for 
servlet AxisServlet threw exception
javax.servlet.ServletException: Servlet execution threw an exception
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.access$000
(ApplicationFilterChain.java:98)
	at org.apache.catalina.core.ApplicationFilterChain$1.run
(ApplicationFilterChain.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:172)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.RequestFilterValve.process
(RequestFilterValve.java:336)
	at org.apache.catalina.valves.RemoteAddrValve.invoke
(RemoteAddrValve.java:131)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:171)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service
(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:601)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
----- Root Cause -----
java.lang.NoSuchFieldError: DEBUG
	at org.apache.commons.logging.impl.Log4JLogger.debug
(Log4JLogger.java:137)
	at org.apache.axis.server.DefaultAxisServerFactory.getServer
(DefaultAxisServerFactory.java:110)
	at org.apache.axis.server.AxisServer.getServer(AxisServer.java:111)
	at org.apache.axis.transport.http.AxisServletBase.getEngine
(AxisServletBase.java:221)
	at org.apache.axis.transport.http.AxisServletBase.getEngine
(AxisServletBase.java:187)
	at org.apache.axis.transport.http.AxisServlet.doGet
(AxisServlet.java:224)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at org.apache.axis.transport.http.AxisServletBase.service
(AxisServletBase.java:339)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.access$000
(ApplicationFilterChain.java:98)
	at org.apache.catalina.core.ApplicationFilterChain$1.run
(ApplicationFilterChain.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:172)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:256)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.RequestFilterValve.process
(RequestFilterValve.java:336)
	at org.apache.catalina.valves.RemoteAddrValve.invoke
(RemoteAddrValve.java:131)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:171)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service
(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:601)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)

Is there anyway to overcome this or do I need to wait for an official release ?
Comment 1 Curt Arnold 2005-07-01 22:38:31 UTC
The current CVS HEAD has broken binary and source compatibility in many ways without significant 
review.  The current goal is to restore binary compatibility (with the potential exception of some fringe 
use-cases) while moving forward to 1.3's release.  My current tack is to get the log4j 1.2 unit tests 
running against the CVS HEAD.  After that is established, will review the particular problem mentioned in 
the initial bug report.  For additional discussion, see http://marc.theaimsgroup.com/?l=log4j-
dev&m=111901190409097&w=2.
Comment 2 Curt Arnold 2005-12-01 17:24:07 UTC
*** Bug 37735 has been marked as a duplicate of this bug. ***
Comment 3 Jess Holle 2005-12-01 17:43:44 UTC
Created attachment 17105 [details]
Proposed patch to one major source of this issue (hoisted from bug #35452)
Comment 4 Curt Arnold 2005-12-30 20:09:51 UTC
The following revisions deal with Priority/Level incompatibility:

r 360145: Adds unit tests to v1_2-branch
r 360147: Adds unit tests to trunk and restores Level extending Priority
Comment 5 Curt Arnold 2005-12-31 00:33:08 UTC
r 360148: Move org.apache.log4j.spi.location.LocationInfo back to o.a.l.spi.
Comment 6 Curt Arnold 2006-01-23 23:31:36 UTC
r 371687 spun off the RepositorySelector.detachRepository method onto a new
interface RepositorySelectorEx.  This method appeared to be called in only one
place in the log4j code base at org.apache.log4j.selector.ContextDetachingSCL
and the only implementation was a NOP in
org.apache.log4j.spi.DefaultRepositorySelector.

The former RepositorySelector.getLoggerRepository(String) was never called in
the log4j code base and the only implementation was in DefaultRepositorySelector
which checked the name against "default" and returned either
getLoggerRepository() or null.  Since the method seemed only to be a place
holder for some future enhancement, I removed it.

These changes should allow apps that provided custom RepositorySelectors to
log4j 1.2 to be compatible with log4j 1.3.  Existing repository selectors based
on the previous 1.3 definition that depend on detachRepositorySelector being
called should change their implements clause to RepositorySelectorEx.

Comment 7 Curt Arnold 2006-01-24 00:21:56 UTC
rev 371712: copied log4j 1.2's implementation of o.a.l.config.PropertyPrinter. 
The log4j 1.2 implementation appeared more current since it had an ASL 2.0
license and used logger instead of Category.  Expanded imports and corrected
misspelling of properties.  Marked print(PrintWriter) as deprecated since it had
been commented out in log4j 1.3 source which was marked as an incompatibility.
Comment 8 Curt Arnold 2006-01-24 05:30:17 UTC
Rev 371792: Restored o.a.l.spi.LoggingEvent.getMDC(String) and getMDCCopy. 
Added back as deprecated methods implemented in terms of the "properties" member
in LoggingEvent that replaced the "mdccopy" member.  After deserialization
getMDC(String) may return values that were set from LoggingRepository
properties, but that does not seem like a bad behavior.

Rev 371802: Removed Configurator.doConfigure(InputStream).  The InputStream form
of configurator was poor since XML and other potential configuration formats
need a base URL to resolve relative resources.  New method was only used by
FileWatchdog which could be rewritten to use file: URL's.  Expect old
implementation would have failed for XML configuration files that had entity
references with relative paths.  The preferred mechanism to create a URL from a
File is file.toURI().toURL() which was introduced in JDK 1.4.  The code attempts
to invoke that by reflection and if that fails, falls back to File.toURL().  If
that fails (which should only occur with exceptionally ugly file names), then an
internal logging message is emitted.
Comment 9 Curt Arnold 2007-08-22 16:06:56 UTC
log4j 1.3 development is abandoned.