You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by minimoe <mi...@gmail.com> on 2007/07/09 10:41:04 UTC

Propagate errors in a scripting application using log4j

Hi!

I've got a question regarding log4j and propagating errors in a program
flow. I'm currently developing test case scripts using Rational Functional
Tester which has a poor logging system and I've looked into using log4j
instead.

I can't find a way to make log4j propagate errors to a "higher instance".
What I would like is for errors found in the "middle" of the program flow to
propagate to the last stage of the process.

An example flow where an error in a subscript propagates to end.

Script 1
 Subscript 1:1 OK!
 Subscript 1:2 ERROR!
 Subscript 1:3 OK!
Script 1 Finished with ERROR in Subscript 1:2.

Would it be good practice to use some kind of hierarchy in which the errors
are sent to a special logger which in turn connects to the top-level-logger
and outputs at the end of the flow?

I'll appreciate any help or tips I can get in this matter!
-- 
View this message in context: http://www.nabble.com/Propagate-errors-in-a-scripting-application-using-log4j-tf4047956.html#a11498006
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Propagate errors in a scripting application using log4j

Posted by Ceki Gulcu <li...@qos.ch>.
You might want to consider logback which handles this task very nicely.

minimoe wrote:
> Hi!
> 
> I've got a question regarding log4j and propagating errors in a program
> flow. I'm currently developing test case scripts using Rational Functional
> Tester which has a poor logging system and I've looked into using log4j
> instead.
> 
> I can't find a way to make log4j propagate errors to a "higher instance".
> What I would like is for errors found in the "middle" of the program flow to
> propagate to the last stage of the process.
> 
> An example flow where an error in a subscript propagates to end.
> 
> Script 1
>  Subscript 1:1 OK!
>  Subscript 1:2 ERROR!
>  Subscript 1:3 OK!
> Script 1 Finished with ERROR in Subscript 1:2.
> 
> Would it be good practice to use some kind of hierarchy in which the errors
> are sent to a special logger which in turn connects to the top-level-logger
> and outputs at the end of the flow?
> 
> I'll appreciate any help or tips I can get in this matter!

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Propagate errors in a scripting application using log4j

Posted by James Stauffer <st...@gmail.com>.
You could write an appender that stores the errors in memory until you
grab them.

On 7/9/07, minimoe <mi...@gmail.com> wrote:
>
> Hi!
>
> I've got a question regarding log4j and propagating errors in a program
> flow. I'm currently developing test case scripts using Rational Functional
> Tester which has a poor logging system and I've looked into using log4j
> instead.
>
> I can't find a way to make log4j propagate errors to a "higher instance".
> What I would like is for errors found in the "middle" of the program flow to
> propagate to the last stage of the process.
>
> An example flow where an error in a subscript propagates to end.
>
> Script 1
>  Subscript 1:1 OK!
>  Subscript 1:2 ERROR!
>  Subscript 1:3 OK!
> Script 1 Finished with ERROR in Subscript 1:2.
>
> Would it be good practice to use some kind of hierarchy in which the errors
> are sent to a special logger which in turn connects to the top-level-logger
> and outputs at the end of the flow?
>
> I'll appreciate any help or tips I can get in this matter!
> --
> View this message in context: http://www.nabble.com/Propagate-errors-in-a-scripting-application-using-log4j-tf4047956.html#a11498006
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Propagate errors in a scripting application using log4j

Posted by Paul Smith <ps...@aconex.com>.
The log4j-receivers module (close to release) actually contains a  
ListModelAppender that you can use to hold events.  It's actually  
designed to display events for Swing GUI's, but since it's a general  
purpose model class, it can be used to hold events for anything.

http://svn.apache.org/repos/asf/logging/log4j/companions/receivers/ 
trunk/src/main/java/org/apache/log4j/varia/ListModelAppender.java

You could certainly grab that class standalone and use it for you  
purposes.

cheers,

Paul

On 09/07/2007, at 6:41 PM, minimoe wrote:

>
> Hi!
>
> I've got a question regarding log4j and propagating errors in a  
> program
> flow. I'm currently developing test case scripts using Rational  
> Functional
> Tester which has a poor logging system and I've looked into using  
> log4j
> instead.
>
> I can't find a way to make log4j propagate errors to a "higher  
> instance".
> What I would like is for errors found in the "middle" of the  
> program flow to
> propagate to the last stage of the process.
>
> An example flow where an error in a subscript propagates to end.
>
> Script 1
>  Subscript 1:1 OK!
>  Subscript 1:2 ERROR!
>  Subscript 1:3 OK!
> Script 1 Finished with ERROR in Subscript 1:2.
>
> Would it be good practice to use some kind of hierarchy in which  
> the errors
> are sent to a special logger which in turn connects to the top- 
> level-logger
> and outputs at the end of the flow?
>
> I'll appreciate any help or tips I can get in this matter!
> -- 
> View this message in context: http://www.nabble.com/Propagate- 
> errors-in-a-scripting-application-using-log4j-tf4047956.html#a11498006
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.