You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Leif Mortenson <le...@tanukisoftware.com> on 2004/07/30 07:19:41 UTC

Question about closing a LogKit PriorityFilteringTarget

I have been investigating a problem where LogTargets wrapped in a
PriorityFilteringTarget were not being closed correctly on application
shutdown.

As it turns out, the cause is in the Excalibur Logger
PriorityFilterTargetFactory.

The logkit PriorityFilteringTarget class has a second constructor which
accepts
a closeWrappedTarget argument. The PriorityFilterTargetFactory is calling
a version of the constructor which defaults to setting that argument to
false.

There are no javadocs explaining the purpose of this argument in the
class, and
I am not sure of the timing of its addition. I am trying to decide where
and how
to fix this problem. I can not think of any reason why you would not want to
close down the wrapped log targets in the first place. But given that
someone
went out of their way to provide this behavior, it seems like closing
them by
default would be better behavior.

If I change the default, then I can do so in the LogKit project and be
done with it.

If however, there is a good reason not to close the wrapped targets down
then
I will need to add a configuration property to the Excalibur logger
PriorityFilterTargetFactory class as It should use the same defaults.

The thing is that if the LogTarget is not wrapped, it will always be closed
down. The case where it is Wrapped by a PriorityFilteringTarget is actually
the only case where it would not be closed.

For now, I am going to modify LogKit so the default is to close the wrapped
LogTargets when the PriorityFilteringTarget is closed. If there are any
concerns about this change then I can go back and change it. I only make
an issue of this because someone appears to have gone out of their way to
make it work this way...

Digging around in CVS, the class was recently created to replace the
deprecated
PriorityFilter. The old system worked differently, so from what I can
tell, this
was not an issue.

Ahh. As I went to commit this, I found that my karma has been revoked
for the
avalon-logkit project. :-( I work on Logkit from time to time so unless
there
was a reason for it, I would still like to have access. :-)

Here is the patch. If someone could commit it I would appreciate it.
In addition to the one line change, there are a few tabs to spaces fixes.

Cheers,
Leif

Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Peter Donald <pe...@realityforge.org>.
Leif Mortenson wrote:
> It looks like this should be handled in Excalibur Logger instead.  I'll 
> go ahead and make
> the appropriate change there.

+1

This is the change I was +1'ing before ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 30 July 2004 13:47, Leif Mortenson wrote:

> I retract my request for the patch to LogKit.  (I would still like
> commit karma though) :-)

Unless Infrastructure has done a mistake, you should already have commit 
access to the entire Avalon subversion repository.


Cheers
Niclas
-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Peter Donald <pe...@realityforge.org>.
Leif Mortenson wrote:
> It looks like this should be handled in Excalibur Logger instead.  I'll 
> go ahead and make
> the appropriate change there.

+1

This is the change I was +1'ing before ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Peter Donald wrote:

>Leif Mortenson wrote:
>  
>
>>I can not think of any reason why you would not want to
>>close down the wrapped log targets in the first place. 
>>    
>>
>
>IIRC it was partially to maintain backwards compatibility and also to
>enable the sharing of log-targets between multiple
>PriorityFilteringTarget objects. (ie have an "error" target that
>triggers a mailout and an "info" target that logs to files).
>  
>
That is how I am using it.  Warning and above get mailed.

>>But given that
>>someone
>>went out of their way to provide this behavior, it seems like closing
>>them by
>>default would be better behavior.
>>    
>>
>
>+1
>
>>For now, I am going to modify LogKit so the default is to close the wrapped
>>LogTargets when the PriorityFilteringTarget is closed. If there are any
>>concerns about this change then I can go back and change it. I only make
>>an issue of this because someone appears to have gone out of their way to
>>make it work this way...
>>    
>>
>
>I think that was me and it will break a lot of code if you make this change.
>  
>
This last statement conflicts with the +1 above?   It sounds like it 
should not be changed.

Looking closer at the code, It does not appear to be possible to 
reference the same
LogTarget more than once when using Excalibur Logger to configure 
LogKit.  But I
do see how it would be possible when referencing LogKit directly.

I retract my request for the patch to LogKit.  (I would still like 
commit karma though) :-)

It looks like this should be handled in Excalibur Logger instead.  I'll 
go ahead and make
the appropriate change there.

Cheers,
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Peter Donald wrote:

>Leif Mortenson wrote:
>  
>
>>I can not think of any reason why you would not want to
>>close down the wrapped log targets in the first place. 
>>    
>>
>
>IIRC it was partially to maintain backwards compatibility and also to
>enable the sharing of log-targets between multiple
>PriorityFilteringTarget objects. (ie have an "error" target that
>triggers a mailout and an "info" target that logs to files).
>  
>
That is how I am using it.  Warning and above get mailed.

>>But given that
>>someone
>>went out of their way to provide this behavior, it seems like closing
>>them by
>>default would be better behavior.
>>    
>>
>
>+1
>
>>For now, I am going to modify LogKit so the default is to close the wrapped
>>LogTargets when the PriorityFilteringTarget is closed. If there are any
>>concerns about this change then I can go back and change it. I only make
>>an issue of this because someone appears to have gone out of their way to
>>make it work this way...
>>    
>>
>
>I think that was me and it will break a lot of code if you make this change.
>  
>
This last statement conflicts with the +1 above?   It sounds like it 
should not be changed.

Looking closer at the code, It does not appear to be possible to 
reference the same
LogTarget more than once when using Excalibur Logger to configure 
LogKit.  But I
do see how it would be possible when referencing LogKit directly.

I retract my request for the patch to LogKit.  (I would still like 
commit karma though) :-)

It looks like this should be handled in Excalibur Logger instead.  I'll 
go ahead and make
the appropriate change there.

Cheers,
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Peter Donald <pe...@realityforge.org>.
Leif Mortenson wrote:
> I can not think of any reason why you would not want to
> close down the wrapped log targets in the first place. 

IIRC it was partially to maintain backwards compatibility and also to
enable the sharing of log-targets between multiple
PriorityFilteringTarget objects. (ie have an "error" target that
triggers a mailout and an "info" target that logs to files).

> But given that
> someone
> went out of their way to provide this behavior, it seems like closing
> them by
> default would be better behavior.

+1

> For now, I am going to modify LogKit so the default is to close the wrapped
> LogTargets when the PriorityFilteringTarget is closed. If there are any
> concerns about this change then I can go back and change it. I only make
> an issue of this because someone appears to have gone out of their way to
> make it work this way...

I think that was me and it will break a lot of code if you make this change.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Peter Donald <pe...@realityforge.org>.
Leif Mortenson wrote:
> I can not think of any reason why you would not want to
> close down the wrapped log targets in the first place. 

IIRC it was partially to maintain backwards compatibility and also to
enable the sharing of log-targets between multiple
PriorityFilteringTarget objects. (ie have an "error" target that
triggers a mailout and an "info" target that logs to files).

> But given that
> someone
> went out of their way to provide this behavior, it seems like closing
> them by
> default would be better behavior.

+1

> For now, I am going to modify LogKit so the default is to close the wrapped
> LogTargets when the PriorityFilteringTarget is closed. If there are any
> concerns about this change then I can go back and change it. I only make
> an issue of this because someone appears to have gone out of their way to
> make it work this way...

I think that was me and it will break a lot of code if you make this change.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leo Simons <ls...@jicarilla.org>.
Leif Mortenson wrote:
> I can not think of any reason why you would not want to
> close down the wrapped log targets in the first place.

IMHO in general if you wrap something you should not assume you can kill
it off later. It's not quite as bad as trying to call stop()/dispose()
on something you look up through a service manager, but it can have the
same results :/

Rather, whatever creates the thing that is wrapped should kill that
thing (thou shall cleane up thine owne mess). My guesss is the best
solution is to refactor the relevant container/excalibur-logger code to
keep track of all the real log targets (not just the wrapped stuff) and
do the closing. But I'm blessed with infamiliarity with most of that
code :-D

cheers,

- LSD


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/


RE: Question about closing a LogKit PriorityFilteringTarget

Posted by Stephen McConnell <mc...@apache.org>.

> -----Original Message-----
> From: Leif Mortenson [mailto:leiflists@tanukisoftware.com]
> Sent: Saturday, July 31, 2004 03:04
> To: Avalon Developers List
> Subject: Re: Question about closing a LogKit PriorityFilteringTarget
> 
> Stephen McConnell wrote:
> 
> >>Locally, you can temporary fix this, by opening runtime/index.xml, and
> >>change
> >>the <group> for LogKit from "avalon/logkit" to "avalon-logkit".
> >>
> >>
> >
> >Or better still - change the <groupId> reference in project.xml from
> >Avalon-logkit to avalon/logkit.
> >
> >
> That is a trend that I would love to see.   I have not seen any examples
> of such a directory
> structure up on Ibiblio yet however.  Has it been verified that this is
> compatible with their
> infrastructure?

Yes - it has been verified.  There are a couple of discrete examples tucked
away on the ibiblio/maven repository that have been working fine for more
than six months.

Steve.

> 
> Cheers,
> Leif
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Stephen McConnell wrote:

>>Locally, you can temporary fix this, by opening runtime/index.xml, and
>>change
>>the <group> for LogKit from "avalon/logkit" to "avalon-logkit".
>>    
>>
>
>Or better still - change the <groupId> reference in project.xml from
>Avalon-logkit to avalon/logkit.
>  
>
That is a trend that I would love to see.   I have not seen any examples 
of such a directory
structure up on Ibiblio yet however.  Has it been verified that this is 
compatible with their
infrastructure?

Cheers,
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


RE: Question about closing a LogKit PriorityFilteringTarget

Posted by Stephen McConnell <mc...@apache.org>.

> -----Original Message-----
> From: Niclas Hedhman [mailto:niclas@hedhman.org]
> Sent: Friday, July 30, 2004 09:32
> To: Avalon Developers List
> Subject: Re: Question about closing a LogKit PriorityFilteringTarget
> 
> On Friday 30 July 2004 15:11, Leif Mortenson wrote:
> 
> > Thanks, I had got this much figured out.   That helpful README.txt in
> > the root does
> > wonders :-)   The whole thing built on the first time through without
> > any problems.
> > Great job!!!
> 
> Thanks. We hope to productify Magic soon, so it will be easy to use in
> other
> projects/products as well.
> 
> > Is there a way to tell Magic to put
> > its targets into
> > the maven local repository?
> 
> Yes. There are the 'properties' and the 'env variable' approach.
> I think setting the environment variable
> MAGIC_HOME=$HOME/.maven/repository
> is the most convenient for you.
> 
> > I thought that I could maybe do this by setting Magic to use the Maven
> > repository, but
> > their directory hierarchies are a bit different.   It looks like the
> > files that Magic downloads
> > use the same structure,  but the avalon targets are all placed into an
> > avalon subdirectory
> > within the repository.
> 
> This is actually not an Magic/Maven issue at all. The structures ARE the
> same,
> but we want to reduce the number of top level directories, and therefor
> moved
> to "avalon/logkit" as the group. One could argue if there is any meaning
> of
> doing this on those artifacts that already have top level directories in
> ibiblio.org/maven
> 
> Locally, you can temporary fix this, by opening runtime/index.xml, and
> change
> the <group> for LogKit from "avalon/logkit" to "avalon-logkit".

Or better still - change the <groupId> reference in project.xml from
Avalon-logkit to avalon/logkit.

Steve.

> 
> 
> Cheers
> Niclas
> 
> --
>    +------//-------------------+
>   / http://www.bali.ac        /
>  / http://niclas.hedhman.org /
> +------//-------------------+
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 30 July 2004 15:11, Leif Mortenson wrote:

> Thanks, I had got this much figured out.   That helpful README.txt in
> the root does
> wonders :-)   The whole thing built on the first time through without
> any problems.
> Great job!!!

Thanks. We hope to productify Magic soon, so it will be easy to use in other 
projects/products as well.

> Is there a way to tell Magic to put
> its targets into
> the maven local repository?

Yes. There are the 'properties' and the 'env variable' approach.
I think setting the environment variable
MAGIC_HOME=$HOME/.maven/repository
is the most convenient for you.

> I thought that I could maybe do this by setting Magic to use the Maven
> repository, but
> their directory hierarchies are a bit different.   It looks like the
> files that Magic downloads
> use the same structure,  but the avalon targets are all placed into an
> avalon subdirectory
> within the repository.

This is actually not an Magic/Maven issue at all. The structures ARE the same, 
but we want to reduce the number of top level directories, and therefor moved 
to "avalon/logkit" as the group. One could argue if there is any meaning of 
doing this on those artifacts that already have top level directories in 
ibiblio.org/maven

Locally, you can temporary fix this, by opening runtime/index.xml, and change 
the <group> for LogKit from "avalon/logkit" to "avalon-logkit".


Cheers
Niclas

-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Niclas Hedhman wrote:

>In that case, it should be useful for you to know the preferred way of 
>building Avalon as well.
>
>You need to go to the Avalon root, and run 
>  ant setup
>
>This creates the Magic extension to Ant.
>After that you can issue 'ant' in any directory and it will build the system 
>below in the correct order.
>Meaning if you build from the root, everything gets built (takes 4-10min dep 
>on machine), but you can step into "runtime" or in this case "runtime/logkit" 
>and run ant from there.
>
>The outputs both goes to the "target" directory in each place, as well as 
>$HOME/.magic/main (organized as Maven repo).
>
>Holler if you run into trouble, as Magic is not 100% reliable on all platforms 
>yet.
>  
>
Thanks, I had got this much figured out.   That helpful README.txt in 
the root does
wonders :-)   The whole thing built on the first time through without 
any problems.
Great job!!!

I'll have to poke around and see what all Magic is capable of doing, but 
the first
impression is quite positive.

One question that I have right off the bat however.   Over in Excalibur, 
we are of course
using Maven to do our builds.   In the current case with Logkit, out 
builds look for the
jar in the {home}/.maven directory.  Is there a way to tell Magic to put 
its targets into
the maven local repository?

I thought that I could maybe do this by setting Magic to use the Maven 
repository, but
their directory hierarchies are a bit different.   It looks like the 
files that Magic downloads
use the same structure,  but the avalon targets are all placed into an 
avalon subdirectory
within the repository.

Taking the Logkit jar as an example.   Magic places it in:
.magic/main/avalon/logkit/jars/avalon-logkit-2.0.0.jar
Where Maven uses:
.maven/repository/avalon-logkit/jars/avalon-logkit-2.0.0.jar

For now, I will go ahead and copy it by hand.

How are you planning on uploading Avalon targets to sites like Ibiblio?
Currently, the logkit jar can be found in
http://www.ibiblio.org/maven/avalon/jars/avalon-logkit-1.2.2.jar
and
http://www.ibiblio.org/maven/avalon-logkit/jars/avalon-logkit-2.0.0.jar

Personally, I like the first option as it keeps the number of root 
directories to a minimum.
But the trend seems to be to use the second.  It doesn't appear that 
there are really
and standards on how it should be done however.

Cheers,
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 30 July 2004 14:12, Leif Mortenson wrote:
> Niclas Hedhman wrote:
> >I hope you realize that LogKit is nowadays in subversion
> >/repos/asf/avalon/trunk/runtime/logkit and that the CVS has been locked
> > down.
>
> That would do it... It has been a little while since I did a commit to
> Avalon :-)  I'll get that working thanks.

In that case, it should be useful for you to know the preferred way of 
building Avalon as well.

You need to go to the Avalon root, and run 
  ant setup

This creates the Magic extension to Ant.
After that you can issue 'ant' in any directory and it will build the system 
below in the correct order.
Meaning if you build from the root, everything gets built (takes 4-10min dep 
on machine), but you can step into "runtime" or in this case "runtime/logkit" 
and run ant from there.

The outputs both goes to the "target" directory in each place, as well as 
$HOME/.magic/main (organized as Maven repo).

Holler if you run into trouble, as Magic is not 100% reliable on all platforms 
yet.

Cheers
Niclas
-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Leif Mortenson <le...@tanukisoftware.com>.
Niclas Hedhman wrote:

>I hope you realize that LogKit is nowadays in subversion 
>/repos/asf/avalon/trunk/runtime/logkit and that the CVS has been locked down.
>  
>
That would do it... It has been a little while since I did a commit to 
Avalon :-)  I'll get that working thanks.
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 30 July 2004 13:19, Leif Mortenson wrote:

> Ahh. As I went to commit this, I found that my karma has been revoked
> for the
> avalon-logkit project. :-( I work on Logkit from time to time so unless
> there
> was a reason for it, I would still like to have access. :-)


I hope you realize that LogKit is nowadays in subversion 
/repos/asf/avalon/trunk/runtime/logkit and that the CVS has been locked down.


Cheers
Niclas
-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: Question about closing a LogKit PriorityFilteringTarget

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 30 July 2004 13:19, Leif Mortenson wrote:

> Ahh. As I went to commit this, I found that my karma has been revoked
> for the
> avalon-logkit project. :-( I work on Logkit from time to time so unless
> there
> was a reason for it, I would still like to have access. :-)


I hope you realize that LogKit is nowadays in subversion 
/repos/asf/avalon/trunk/runtime/logkit and that the CVS has been locked down.


Cheers
Niclas
-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/