You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Paul Smith <ps...@aconex.com> on 2007/04/28 09:17:55 UTC
maven dependencies for JULBridge
Ok, I have a local patch that adds a new JULReceiver class plus unit
test that works fine if I add the log4j-component Eclipse project as
a dependency. Yet, if I remove that project dependency, and add a
maven dependency to apache-log4j-component 0.1-SNAPHOT after 'mvn
install' that into my local repository, it still compiles, yet the
test case doesn't pass, because the Receiver never gets constructed
and no event is received. I get DomConfigurator warnings about not
recognizing the plugin tags:
log4j:WARN Element type "plugin" must be declared.
log4j:WARN Continuable parsing error 25 and column 23
log4j:WARN The content of element type "log4j:configuration" must
match "(renderer*,appender*,(category|logger)*,root?,categoryFactory?)".
log4j: Threshold ="null".
log4j: Level value for root is [debug].
log4j: root level set to DEBUG
Apr 28, 2007 5:10:44 PM org.apache.log4j.jul.JULReceiverTest
testJULReceiverPluginConfiguration
INFO: boo
My local patch is attached for review. I just don't get it. It's as
if the installed component jar in the repo is different than the
Eclipse project version, but I've hand removed it from the repo, and
redeployed it. I'm using the Maven Eclipse plugin, but even running
the tests locally fail, so I don't think it's that. I tried mucking
about with the pom.xml by hand.
Any ideas?

Re: maven dependencies for JULBridge
Posted by Curt Arnold <ca...@apache.org>.
On Apr 28, 2007, at 10:47 PM, Paul Smith wrote:
>>
>> My suggestions:
>>
>> a) If you built log4j 1.2.15 with Maven, remove it from the
>> repository, build it with Ant and install it using mvn
>> install:install-file (attempt to build the bridge and it will tell
>> you the syntax). The Maven build doesn't include the log4j.dtd,
>> LICENSE, NOTICE and other resources that the Ant build places in
>> the Jar.
>>
> I've been doing this in the 1.2 source treee for the last week or
> so, to keep my local maven repo up2date with the 1.2.15
>
> ant clean jar
> mvn install:install-file -DgroupId=log4j -DartifactId=log4j -
> Dversion=1.2.15 -Dpackaging=jar -Dfile=/workspace/log4j12/dist/lib/
> log4j-1.2.15.jar
>
Good. I could see trying to do a straight mvn install would be
tempting but dangerous.
>> b) svn update component and mvn install
>>
>> c) Try to run the tests again on a fresh checkout. If the test
>> fails under Maven, try the ant build.
>>
>> If eclipse and ant pass and maven fails, then we should take take
>> it to users@maven. I would suggest before doing that downloading
>> and installing a Gump built log4j 1.2.15 and trying the process
>> again. It would make it easier for any Maven guru debugging the
>> issue to not have to learn how to build log4j.
>
> Weird, works with ant, but in Eclipse (maven plugin) and with maven
> I now get a somewhat different error (see results further below).
> I now get a NoSuchMethodError:
>
> java.lang.NoSuchMethodError:
> org.apache.log4j.spi.LocationInfo.<init>(Ljava/lang/String;Ljava/
> lang/String;Ljava/lang/String;Ljava/lang/String;)V
> at org.apache.logging.julbridge.JULLog4jEventConverter.convert
> (JULLog4jEventConverter.java:124)
> at org.apache.logging.julbridge.JULBridgeHandler.publish
> (JULBridgeHandler.java:49)
> at java.util.logging.Logger.log(Logger.java:428)
> at java.util.logging.Logger.doLog(Logger.java:450)
> at java.util.logging.Logger.log(Logger.java:473)
> at java.util.logging.Logger.info(Logger.java:992)
> at
> org.apache.log4j.jul.JULReceiverTest.testJULReceiverPluginConfiguratio
> n(JULReceiverTest.java:43)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ...
Looks like the classloader is pulling in the log4j that Maven is
configured to use. The method not found is one of the new constructors.
>
> What's interesting is that if I blow away the log4j section of my
> local maven repo, then install the 1.2.15 jar into the repo, when I
> run 'mvn test' inside the JULI bridge, I see this:
>
> Paul-Smiths-Computer:/workspace/juli-log4j-bridge paulsmith$ mvn test
> [INFO] Scanning for projects...
> [INFO]
> ----------------------------------------------------------------------
> ------
> [INFO] Building Unnamed - org.apache.logging:apache-juli-log4j-
> bridge:jar:0.1.0
> [INFO] task-segment: [test]
> [INFO]
> ----------------------------------------------------------------------
> ------
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.15/
> log4j-1.2.15.pom
> Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.14/
> log4j-1.2.14.pom
> 2K downloaded
> [INFO] [compiler:compile]
> .....
>
> It seems to want to download the 1.2.14 stuff, but I can't see why
> exactly.
I tried playing with several configuration tweaks with the surefire
plugin, but didn't find any joy.
>
> How was the build.xml generated? Is the build.xml file generated
> from maven?
By hand. Since Gump doesn't support Maven 2, I wrote a pretty simple
Ant build for each of the sandbox projects and have added the
projects to Gump's list of projects. Filters and PatternLayout seem
to be building fine and I think I have the nag messages going to
log4j-dev. Component is failing like it was getting the bridge code
by mistake, but all the project descriptors look right. I had put in
a project for the bridge but took it out when it looked like it was
going to be dormant for a while. No benefit for adding it back until
the weirdness with component is
>
> I'm going to commit my local change for now and try the maven list.
>
I'll keep an eye on it.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: maven dependencies for JULBridge
Posted by Paul Smith <ps...@aconex.com>.
On 29/04/2007, at 1:13 PM, Curt Arnold wrote:
>
> On Apr 28, 2007, at 4:32 PM, Paul Smith wrote:
>
>>
>> On 28/04/2007, at 10:16 PM, Curt Arnold wrote:
>>
>>> Did you svn update, rebuild and install log4j 1.2.15? The
>>> fragment of DTD that shines through in the warnings is prior to
>>> the recent changes to log4j 1.2.15.
>>
>> Definitely, several times.
>>
>
> I found a bug in component, but I don't think it affected you.
> Also the Ant build was out of sync. I'm thinking the likely
> culprit is an Maven built log4j 1.2.15 triggering chaos due to a
> missing log4j.dtd resource.
>
> My suggestions:
>
> a) If you built log4j 1.2.15 with Maven, remove it from the
> repository, build it with Ant and install it using mvn
> install:install-file (attempt to build the bridge and it will tell
> you the syntax). The Maven build doesn't include the log4j.dtd,
> LICENSE, NOTICE and other resources that the Ant build places in
> the Jar.
>
I've been doing this in the 1.2 source treee for the last week or
so, to keep my local maven repo up2date with the 1.2.15
ant clean jar
mvn install:install-file -DgroupId=log4j -DartifactId=log4j -
Dversion=1.2.15 -Dpackaging=jar -Dfile=/workspace/log4j12/dist/lib/
log4j-1.2.15.jar
> b) svn update component and mvn install
>
> c) Try to run the tests again on a fresh checkout. If the test
> fails under Maven, try the ant build.
>
> If eclipse and ant pass and maven fails, then we should take take
> it to users@maven. I would suggest before doing that downloading
> and installing a Gump built log4j 1.2.15 and trying the process
> again. It would make it easier for any Maven guru debugging the
> issue to not have to learn how to build log4j.
Weird, works with ant, but in Eclipse (maven plugin) and with maven I
now get a somewhat different error (see results further below). I
now get a NoSuchMethodError:
java.lang.NoSuchMethodError: org.apache.log4j.spi.LocationInfo.<init>
(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/
String;)V
at org.apache.logging.julbridge.JULLog4jEventConverter.convert
(JULLog4jEventConverter.java:124)
at org.apache.logging.julbridge.JULBridgeHandler.publish
(JULBridgeHandler.java:49)
at java.util.logging.Logger.log(Logger.java:428)
at java.util.logging.Logger.doLog(Logger.java:450)
at java.util.logging.Logger.log(Logger.java:473)
at java.util.logging.Logger.info(Logger.java:992)
at
org.apache.log4j.jul.JULReceiverTest.testJULReceiverPluginConfiguration(
JULReceiverTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
What's interesting is that if I blow away the log4j section of my
local maven repo, then install the 1.2.15 jar into the repo, when I
run 'mvn test' inside the JULI bridge, I see this:
Paul-Smiths-Computer:/workspace/juli-log4j-bridge paulsmith$ mvn test
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
----
[INFO] Building Unnamed - org.apache.logging:apache-juli-log4j-
bridge:jar:0.1.0
[INFO] task-segment: [test]
[INFO]
------------------------------------------------------------------------
----
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.15/
log4j-1.2.15.pom
Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.14/
log4j-1.2.14.pom
2K downloaded
[INFO] [compiler:compile]
.....
It seems to want to download the 1.2.14 stuff, but I can't see why
exactly.
How was the build.xml generated? Is the build.xml file generated
from maven?
I'm going to commit my local change for now and try the maven list.
[ant test versus mvn test]
Paul-Smiths-Computer:/workspace/juli-log4j-bridge paulsmith$ ant test
Buildfile: build.xml
init:
compile:
test-compile:
test:
[junit] Running org.apache.log4j.jul.JULReceiverTest
[junit] Testsuite: org.apache.log4j.jul.JULReceiverTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed:
0.641 sec
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed:
0.641 sec
[junit] ------------- Standard Output ---------------
[junit] log4j: Threshold ="null".
[junit] log4j: Pushing plugin on to the object stack.
[junit] log4j: Level value for root is [debug].
[junit] log4j: root level set to DEBUG
[junit] ------------- ---------------- ---------------
[junit]
[junit] Testcase: testJULReceiverPluginConfiguration took 0.629 sec
[junit] Running org.apache.logging.julbridge.JULLog4jBridgeTest
[junit] Testsuite: org.apache.logging.julbridge.JULLog4jBridgeTest
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed:
0.128 sec
[junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed:
0.128 sec
[junit]
[junit] Testcase: testBridgeJULLogger took 0.119 sec
[junit] Testcase: testLocationInfo took 0.001 sec
[junit] Testcase: testAbsorbedIntoTheLog4jCollective took 0.002 sec
[junit] Testcase: testJULLevelConfigurationChanges took 0 sec
BUILD SUCCESSFUL
Total time: 2 seconds
Paul-Smiths-Computer:/workspace/juli-log4j-bridge paulsmith$ mvn test
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
----
[INFO] Building Unnamed - org.apache.logging:apache-juli-log4j-
bridge:jar:0.1.0
[INFO] task-segment: [test]
[INFO]
------------------------------------------------------------------------
----
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: /workspace/juli-log4j-bridge/target/
surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.logging.julbridge.JULLog4jBridgeTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.228
sec
Running org.apache.logging.julbridge.TestLogPosting
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046
sec
Running org.apache.log4j.jul.JULReceiverTest
log4j: Threshold ="null".
log4j: Pushing plugin on to the object stack.
log4j: Level value for root is [debug].
log4j: root level set to DEBUG
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.365
sec <<< FAILURE!
Results :
Failed tests:
testJULReceiverPluginConfiguration
(org.apache.log4j.jul.JULReceiverTest)
Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Sun Apr 29 13:42:01 EST 2007
[INFO] Final Memory: 4M/9M
[INFO]
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: maven dependencies for JULBridge
Posted by Curt Arnold <ca...@apache.org>.
On Apr 28, 2007, at 4:32 PM, Paul Smith wrote:
>
> On 28/04/2007, at 10:16 PM, Curt Arnold wrote:
>
>> Did you svn update, rebuild and install log4j 1.2.15? The
>> fragment of DTD that shines through in the warnings is prior to
>> the recent changes to log4j 1.2.15.
>
> Definitely, several times.
>
I found a bug in component, but I don't think it affected you. Also
the Ant build was out of sync. I'm thinking the likely culprit is an
Maven built log4j 1.2.15 triggering chaos due to a missing log4j.dtd
resource.
My suggestions:
a) If you built log4j 1.2.15 with Maven, remove it from the
repository, build it with Ant and install it using mvn
install:install-file (attempt to build the bridge and it will tell
you the syntax). The Maven build doesn't include the log4j.dtd,
LICENSE, NOTICE and other resources that the Ant build places in the
Jar.
b) svn update component and mvn install
c) Try to run the tests again on a fresh checkout. If the test fails
under Maven, try the ant build.
If eclipse and ant pass and maven fails, then we should take take it
to users@maven. I would suggest before doing that downloading and
installing a Gump built log4j 1.2.15 and trying the process again.
It would make it easier for any Maven guru debugging the issue to not
have to learn how to build log4j.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: maven dependencies for JULBridge
Posted by Paul Smith <ps...@aconex.com>.
On 28/04/2007, at 10:16 PM, Curt Arnold wrote:
> Did you svn update, rebuild and install log4j 1.2.15? The fragment
> of DTD that shines through in the warnings is prior to the recent
> changes to log4j 1.2.15.
Definitely, several times.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: maven dependencies for JULBridge
Posted by Curt Arnold <ca...@apache.org>.
Did you svn update, rebuild and install log4j 1.2.15? The fragment
of DTD that shines through in the warnings is prior to the recent
changes to log4j 1.2.15.
On Apr 28, 2007, at 2:17 AM, Paul Smith wrote:
> Ok, I have a local patch that adds a new JULReceiver class plus
> unit test that works fine if I add the log4j-component Eclipse
> project as a dependency. Yet, if I remove that project dependency,
> and add a maven dependency to apache-log4j-component 0.1-SNAPHOT
> after 'mvn install' that into my local repository, it still
> compiles, yet the test case doesn't pass, because the Receiver
> never gets constructed and no event is received. I get
> DomConfigurator warnings about not recognizing the plugin tags:
>
> log4j:WARN Element type "plugin" must be declared.
> log4j:WARN Continuable parsing error 25 and column 23
> log4j:WARN The content of element type "log4j:configuration" must
> match "(renderer*,appender*,(category|logger)
> *,root?,categoryFactory?)".
> log4j: Threshold ="null".
> log4j: Level value for root is [debug].
> log4j: root level set to DEBUG
> Apr 28, 2007 5:10:44 PM org.apache.log4j.jul.JULReceiverTest
> testJULReceiverPluginConfiguration
> INFO: boo
>
>
> My local patch is attached for review. I just don't get it. It's
> as if the installed component jar in the repo is different than the
> Eclipse project version, but I've hand removed it from the repo,
> and redeployed it. I'm using the Maven Eclipse plugin, but even
> running the tests locally fail, so I don't think it's that. I
> tried mucking about with the pom.xml by hand.
>
> Any ideas?
>
>
>
> <julbridge.patch>