You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Gregan, Miroslav" <mi...@siemens.com> on 2007/11/13 16:35:02 UTC

how to set the logger?

Hi,
 
I need to use FOP 0.94 embedded, in a big project composed by different Eclipse's plug-ins where 2 of them define an "org.apache.commons.logging.Log" library, which causes me the following error:
 
    "Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed."

Is there a way how to set the logger "manually" like it was done before in FOP 0.20.5 by setting the Driver object?

Thank you.

Miro

__________________________________________

 

Ing. Miroslav Gregáň

Member of the "Siemens IT Solutions and Services" department
from the PSE SK SES TEC SK2 team

Program and System Engineering
Slovakia
Software Engineering Services
Technology Competences
Skupina 2 (Java and OpenSource Technologies)

Siemens Program and System Engineering s.r.o.
Dubravska cesta 4
845 37 Bratislava
Slovak Republic

 

RE: how to set the logger?

Posted by "Gregan, Miroslav" <mi...@siemens.com>.
Well, I found what was the problem:

In the org.apache.logging.impl.LogFactoryImpl the following constructor
calls the loadClass() method

	protected Constructor getLogConstructor()
        throws LogConfigurationException {

        // Return the previously identified Constructor (if any)
        if (logConstructor != null) {
            return logConstructor;
        }

        String logClassName = getLogClassName();

        // Attempt to load the Log implementation class
        Class logClass = null;
        Class logInterface = null;
        try {
            logInterface = this.getClass().getClassLoader().loadClass
                (LOG_INTERFACE);
            logClass = loadClass(logClassName);

And this one do the following: Method method =
Thread.class.getMethod("getContextClassLoader", null)

Which in my case calls the OSGI classLoader instead of the plugin's one
:(

So I downloaded the latest org.apache.logging library (1.1) in order to
test it,
and fortunately for me, it's "correctly" implemented for my purpose :)


So thanks for your help,

Cheers,

Miro


-----Original Message-----
From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Sent: Tuesday, November 13, 2007 9:11 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: how to set the logger?

On Nov 13, 2007, at 16:35, Gregan, Miroslav wrote:

> I need to use FOP 0.94 embedded, in a big project composed by  
> different Eclipse's plug-ins where 2 of them define an  
> "org.apache.commons.logging.Log" library, which causes me the  
> following error:
>
>     "Invalid class loader hierarchy. You have more than one version  
> of 'org.apache.commons.logging.Log' visible, which is not allowed."
> Is there a way how to set the logger "manually" like it was done  
> before in FOP 0.20.5 by setting the Driver object?

More or less the same answer as another thread I just posted a reply  
in...
In short: currently, no. The loggers are static, class-based, and  
cannot be overridden. They are more meant for debug info during  
development.

OTOH, I don't believe we use any specific version of Commons logging,  
so maybe you could try to make FOP use the other version (or make the  
other plugins use the jar that is distributed with FOP) Have you  
already tried removing one version from the classpath?


Cheers

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: how to set the logger?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Nov 13, 2007, at 16:35, Gregan, Miroslav wrote:

> I need to use FOP 0.94 embedded, in a big project composed by  
> different Eclipse's plug-ins where 2 of them define an  
> "org.apache.commons.logging.Log" library, which causes me the  
> following error:
>
>     "Invalid class loader hierarchy. You have more than one version  
> of 'org.apache.commons.logging.Log' visible, which is not allowed."
> Is there a way how to set the logger "manually" like it was done  
> before in FOP 0.20.5 by setting the Driver object?

More or less the same answer as another thread I just posted a reply  
in...
In short: currently, no. The loggers are static, class-based, and  
cannot be overridden. They are more meant for debug info during  
development.

OTOH, I don't believe we use any specific version of Commons logging,  
so maybe you could try to make FOP use the other version (or make the  
other plugins use the jar that is distributed with FOP) Have you  
already tried removing one version from the classpath?


Cheers

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org