You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by James Strachan <ja...@gmail.com> on 2006/03/09 12:47:18 UTC
[IDE malarkey] dealing with log4j in your IDE versus Maven
This might be completely obvious to everyone - but I just thought I'd
explain what I've just started doing with my IDE and I wished I'd
done this a long long time ago...
So ActiveMQ uses log4j.properties on the classpath (usually in
$module/src/test/resources/). By default the logging level is INFO
and it goes to a log file so that when you run the maven build it
doesn't fill the screen with lots of garbage. (Incidentally some
tests are timing sensitive, so setting logging level to DEBUG will
often cause some tests to fail as debug logging slows things down so
much)
However when running stuff in your IDE - e.g. working on a specific
test case or program, you often want output to the console so you see
it nicely in your IDE. Often you want debug too.
So for the longest time I've been hacking, say, the activemq-core/src/
test/resources/log4j.properties file for IDE use to enable stdout /
DEBUG; then having to remember to switch it back when doing
subversion commits etc.
I'm sure somewhere there's a great log4j plugin to eclipse that
actually works well (I've tried a few plugins for IDEs over the years
and never managed to get them to work well); but as a quick hack I
created a new project called IDE which just contains stuff to put on
the classpath when running stuff in your IDE; so added a
log4j.properties for IDE use. Then I added this as the first
dependency in the ActiveMQ project and voila - no more hack-revert of
the log4j.properties in the maven build; I can keep the 2 separate.
Totally trivial and obvious - and I'm sure some ecilpse plugin
somewhere solves this better - but its well worth doing something
like this if you hack on the ActiveMQ code a fair bit.
James
-------
http://radio.weblogs.com/0112098/
Re: [IDE malarkey] dealing with log4j in your IDE versus Maven
Posted by James Strachan <ja...@gmail.com>.
Even better! :)
James
On 3/9/06, Guillaume Nodet <gu...@worldonline.fr> wrote:
>
> In ServiceMix, i solved the problem by specifying another log4j
> configuration that is used in maven only.
>
> Just add the following lines in the project.properties
> maven.junit.sysproperties=log4j.configuration
> log4j.configuration=log4j-tests.properties
>
> and magically, maven tests will be run using log4j-tests.properties and
> the IDE will use default log4j.properties.
>
> Guillaume
>
>
> James Strachan wrote:
>
> > This might be completely obvious to everyone - but I just thought I'd
> > explain what I've just started doing with my IDE and I wished I'd
> > done this a long long time ago...
> >
> > So ActiveMQ uses log4j.properties on the classpath (usually in
> > $module/src/test/resources/). By default the logging level is INFO
> > and it goes to a log file so that when you run the maven build it
> > doesn't fill the screen with lots of garbage. (Incidentally some
> > tests are timing sensitive, so setting logging level to DEBUG will
> > often cause some tests to fail as debug logging slows things down so
> > much)
> >
> > However when running stuff in your IDE - e.g. working on a specific
> > test case or program, you often want output to the console so you see
> > it nicely in your IDE. Often you want debug too.
> >
> > So for the longest time I've been hacking, say, the activemq-core/src/
> > test/resources/log4j.properties file for IDE use to enable stdout /
> > DEBUG; then having to remember to switch it back when doing
> > subversion commits etc.
> >
> > I'm sure somewhere there's a great log4j plugin to eclipse that
> > actually works well (I've tried a few plugins for IDEs over the years
> > and never managed to get them to work well); but as a quick hack I
> > created a new project called IDE which just contains stuff to put on
> > the classpath when running stuff in your IDE; so added a
> > log4j.properties for IDE use. Then I added this as the first
> > dependency in the ActiveMQ project and voila - no more hack-revert of
> > the log4j.properties in the maven build; I can keep the 2 separate.
> >
> > Totally trivial and obvious - and I'm sure some ecilpse plugin
> > somewhere solves this better - but its well worth doing something
> > like this if you hack on the ActiveMQ code a fair bit.
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
> >
> >
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: [IDE malarkey] dealing with log4j in your IDE versus Maven
Posted by Guillaume Nodet <gu...@worldonline.fr>.
In ServiceMix, i solved the problem by specifying another log4j
configuration that is used in maven only.
Just add the following lines in the project.properties
maven.junit.sysproperties=log4j.configuration
log4j.configuration=log4j-tests.properties
and magically, maven tests will be run using log4j-tests.properties and
the IDE will use default log4j.properties.
Guillaume
James Strachan wrote:
> This might be completely obvious to everyone - but I just thought I'd
> explain what I've just started doing with my IDE and I wished I'd
> done this a long long time ago...
>
> So ActiveMQ uses log4j.properties on the classpath (usually in
> $module/src/test/resources/). By default the logging level is INFO
> and it goes to a log file so that when you run the maven build it
> doesn't fill the screen with lots of garbage. (Incidentally some
> tests are timing sensitive, so setting logging level to DEBUG will
> often cause some tests to fail as debug logging slows things down so
> much)
>
> However when running stuff in your IDE - e.g. working on a specific
> test case or program, you often want output to the console so you see
> it nicely in your IDE. Often you want debug too.
>
> So for the longest time I've been hacking, say, the activemq-core/src/
> test/resources/log4j.properties file for IDE use to enable stdout /
> DEBUG; then having to remember to switch it back when doing
> subversion commits etc.
>
> I'm sure somewhere there's a great log4j plugin to eclipse that
> actually works well (I've tried a few plugins for IDEs over the years
> and never managed to get them to work well); but as a quick hack I
> created a new project called IDE which just contains stuff to put on
> the classpath when running stuff in your IDE; so added a
> log4j.properties for IDE use. Then I added this as the first
> dependency in the ActiveMQ project and voila - no more hack-revert of
> the log4j.properties in the maven build; I can keep the 2 separate.
>
> Totally trivial and obvious - and I'm sure some ecilpse plugin
> somewhere solves this better - but its well worth doing something
> like this if you hack on the ActiveMQ code a fair bit.
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
>
>