You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/01/15 17:00:23 UTC
Asynchronous LogTarget
I attempted to make use of the Asynchronous LogTarget for Cocoon, however
the LogKit implementation could not do it. I kept getting a "could not
write to closed file" message written to the Tomcat log for each log
message.
Obviously that is not acceptable--and asynchronous logging is key to
Cocoon's performance. Those who are familiar with the AsyncLogTarget,
could you please give me some hints as to what may have gone wrong?
The AsyncLogTarget is crucial for server side logging approaches.
Errors should be logged immediately, and therefore should block, but
all other log messages shouldn't block.
That will help speed Cocoon's performance alot--even when logging
at the DEBUG level!
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Asynchronous LogTarget
Posted by Berin Loritsch <bl...@apache.org>.
Peter Donald wrote:
> On Wed, 16 Jan 2002 15:57, Berin Loritsch wrote:
>
>>Peter Donald wrote:
>>
>>>Are you using the CVS version of it?
>>>
>>Yes.
>>
>
> you sure ?
I believe the problem *may* have to do with the factory class
in LogKitManager then.
BTW, shouldn't the thread that AsyncLogTarget be marked as a
daemon thread? That would allow you to simply return from
the Main class, and not do a hard System.exit().
>
> The following works for me
>
> package org.apache.log.output;
>
> import org.apache.log.Hierarchy;
> import org.apache.log.Logger;
> import org.apache.log.LogTarget;
> import org.apache.log.format.PatternFormatter;
> import org.apache.log.output.io.StreamTarget;
>
> public class AsyncLogTest
> {
>
> public static void main( String[] args )
> {
> final PatternFormatter formatter = new PatternFormatter(
> "%{message}\n" );
> final LogTarget mySlowTarget = new StreamTarget( System.out,
> formatter );
> AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
> Thread thread = new Thread( asyncTarget );
> thread.setPriority( Thread.MIN_PRIORITY );
> thread.start();
>
> final Hierarchy h = new Hierarchy();
> final Logger logger = h.getLoggerFor( "meep" );
> logger.setLogTargets( new LogTarget[] { asyncTarget } );
>
> logger.debug( "meep meep!" );
> logger.debug( "meep meep!" );
> logger.debug( "meep meep!" );
> }
> }
>
>
>
>
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Asynchronous LogTarget
Posted by Peter Donald <pe...@apache.org>.
On Wed, 16 Jan 2002 15:57, Berin Loritsch wrote:
> Peter Donald wrote:
> > Are you using the CVS version of it?
>
> Yes.
you sure ?
The following works for me
package org.apache.log.output;
import org.apache.log.Hierarchy;
import org.apache.log.Logger;
import org.apache.log.LogTarget;
import org.apache.log.format.PatternFormatter;
import org.apache.log.output.io.StreamTarget;
public class AsyncLogTest
{
public static void main( String[] args )
{
final PatternFormatter formatter = new PatternFormatter(
"%{message}\n" );
final LogTarget mySlowTarget = new StreamTarget( System.out,
formatter );
AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
Thread thread = new Thread( asyncTarget );
thread.setPriority( Thread.MIN_PRIORITY );
thread.start();
final Hierarchy h = new Hierarchy();
final Logger logger = h.getLoggerFor( "meep" );
logger.setLogTargets( new LogTarget[] { asyncTarget } );
logger.debug( "meep meep!" );
logger.debug( "meep meep!" );
logger.debug( "meep meep!" );
}
}
--
Cheers,
Pete
--------------------------------
These aren't the droids you're
looking for. Move along.
--------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Asynchronous LogTarget
Posted by Berin Loritsch <bl...@apache.org>.
Peter Donald wrote:
> Are you using the CVS version of it?
Yes.
>
> On Wed, 16 Jan 2002 03:00, Berin Loritsch wrote:
>
>>I attempted to make use of the Asynchronous LogTarget for Cocoon, however
>>the LogKit implementation could not do it. I kept getting a "could not
>>write to closed file" message written to the Tomcat log for each log
>>message.
>>
>>Obviously that is not acceptable--and asynchronous logging is key to
>>Cocoon's performance. Those who are familiar with the AsyncLogTarget,
>>could you please give me some hints as to what may have gone wrong?
>>
>>The AsyncLogTarget is crucial for server side logging approaches.
>>Errors should be logged immediately, and therefore should block, but
>>all other log messages shouldn't block.
>>
>>That will help speed Cocoon's performance alot--even when logging
>>at the DEBUG level!
>>
>
----------------------------------------------------
Sign Up for NetZero Platinum Today
Only $9.95 per month!
http://my.netzero.net/s/signup?r=platinum&refcd=PT97
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Asynchronous LogTarget
Posted by Peter Donald <pe...@apache.org>.
Are you using the CVS version of it?
On Wed, 16 Jan 2002 03:00, Berin Loritsch wrote:
> I attempted to make use of the Asynchronous LogTarget for Cocoon, however
> the LogKit implementation could not do it. I kept getting a "could not
> write to closed file" message written to the Tomcat log for each log
> message.
>
> Obviously that is not acceptable--and asynchronous logging is key to
> Cocoon's performance. Those who are familiar with the AsyncLogTarget,
> could you please give me some hints as to what may have gone wrong?
>
> The AsyncLogTarget is crucial for server side logging approaches.
> Errors should be logged immediately, and therefore should block, but
> all other log messages shouldn't block.
>
> That will help speed Cocoon's performance alot--even when logging
> at the DEBUG level!
--
Cheers,
Pete
---------------------------------------
Be nice to your friends. If it weren't
for them, you'd be a complete stranger.
---------------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>