You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Andrea Vaccaro <a....@quinary.com> on 2005/02/21 12:28:09 UTC

Logger error with multiple Velocity engines

Hello,
we have found out that if you instance and init multiple engines, under some circumstances that are not yet clear, there is an error on the log4j logger.

For example the following code:

public static void main(String[] args) throws Exception
{
       VelocityEngine[] engines = new VelocityEngine[4];
        
        for (int i = 0; i < engines.length; i++)
        {
            VelocityEngine engine = new VelocityEngine();
            engine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, "C:\\temp");
            engine.init();
        }
}

will generate 141 lines of the following error:

log4j:ERROR Attempted to append to closed appender named [null].

Debugging Velocity source code we noticed that all the engines add an appender to the same shared logger and sometime a null appender is added.
We are currently using Velocity 1.4 and Log4J 1.2.9.

Thanks in advance,
Andrea and Giannandrea

Re: Logger error with multiple Velocity engines

Posted by Andrea Vaccaro <a....@quinary.com>.
Hi Will,
I posted the bug on bugzilla, see
http://issues.apache.org/bugzilla/show_bug.cgi?id=33695.

Regards,
Andrea

On Mon, 2005-02-21 at 10:14 -0800, Will Glass-Husain wrote:
> Hi Andrea,
> 
> Thanks for the bug report.  Would you mind posting this on Bugzilla?
> http://issues.apache.org/
> 
> There's a couple of issues with the log4j system (the others involve closing 
> the Logger properly).  I'd like to work on them all at once after finishing 
> current stuff.
> 
> Best,
> WILL
> 
> 
> ----- Original Message ----- 
> From: "Andrea Vaccaro" <a....@quinary.com>
> To: <ve...@jakarta.apache.org>
> Sent: Monday, February 21, 2005 3:28 AM
> Subject: Logger error with multiple Velocity engines
> 
> 
> Hello,
> we have found out that if you instance and init multiple engines, under some 
> circumstances that are not yet clear, there is an error on the log4j logger.
> 
> For example the following code:
> 
> public static void main(String[] args) throws Exception
> {
>        VelocityEngine[] engines = new VelocityEngine[4];
> 
>         for (int i = 0; i < engines.length; i++)
>         {
>             VelocityEngine engine = new VelocityEngine();
>             engine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, 
> "C:\\temp");
>             engine.init();
>         }
> }
> 
> will generate 141 lines of the following error:
> 
> log4j:ERROR Attempted to append to closed appender named [null].
> 
> Debugging Velocity source code we noticed that all the engines add an 
> appender to the same shared logger and sometime a null appender is added.
> We are currently using Velocity 1.4 and Log4J 1.2.9.
> 
> Thanks in advance,
> Andrea and Giannandrea
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 

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


Re: Logger error with multiple Velocity engines

Posted by Will Glass-Husain <wg...@forio.com>.
Hi Andrea,

Thanks for the bug report.  Would you mind posting this on Bugzilla?
http://issues.apache.org/

There's a couple of issues with the log4j system (the others involve closing 
the Logger properly).  I'd like to work on them all at once after finishing 
current stuff.

Best,
WILL


----- Original Message ----- 
From: "Andrea Vaccaro" <a....@quinary.com>
To: <ve...@jakarta.apache.org>
Sent: Monday, February 21, 2005 3:28 AM
Subject: Logger error with multiple Velocity engines


Hello,
we have found out that if you instance and init multiple engines, under some 
circumstances that are not yet clear, there is an error on the log4j logger.

For example the following code:

public static void main(String[] args) throws Exception
{
       VelocityEngine[] engines = new VelocityEngine[4];

        for (int i = 0; i < engines.length; i++)
        {
            VelocityEngine engine = new VelocityEngine();
            engine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, 
"C:\\temp");
            engine.init();
        }
}

will generate 141 lines of the following error:

log4j:ERROR Attempted to append to closed appender named [null].

Debugging Velocity source code we noticed that all the engines add an 
appender to the same shared logger and sometime a null appender is added.
We are currently using Velocity 1.4 and Log4J 1.2.9.

Thanks in advance,
Andrea and Giannandrea


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