You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Jerry <je...@gmail.com> on 2016/04/06 18:17:34 UTC

what are pdfbox logging requirements?

I have a web app, which runs in tomcat8 using log4j2.  The app works 
correctly.

Now I am trying to add the ability to write a PDF file from the app, 
using pdfbox-app-2.00.jar.

First, I wrote a testbed program to verify that I can generate a valid 
PDF.  In order to make it work, I downloaded  Apache's 
commons-logging-1.2-bin.zip and added commons-logging-1.2.jar to the 
testbed classpath.  That testbed now works.

So now I'm trying to make it work within the webapp.

I have added both the pdfbox and commons-logging jars to the webapps 
classpath, and I have imported pdfbox classes into the app. The log4j 
libraries are contained in the webapp's WEB-INF/lib folder.

When I launch the app, I get a bunch of logging TRACE messages about 
"trying to find" various forms of log4j2 properties, like the follo0wing...

TRACE StatusLogger Trying to find [log4j2-test/iBook.properties] using 
context class loader WebappClassLoader
   context: iBook
   delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@42f30e0a
.

...then an ERROR message that no log4j2 configuration could be found.

There is a valid log4j2 configuration XML in tomcat's conf directory, 
which the webapp is able to find and use.

After these messages, the webapp starts.

But as soon as I try to log in to the app, it fails, because it was 
unable to authenticate the user (the app uses JAAS authentication, which 
is apparently being blocked by the PdfBox/log4j2 problem).

All of this happens only after I add PdfBox to the app, which otherwise 
works fine.

Do you have any insight to offer as to what might be the conflict?

Are PdfBox and Log4j2 incompatible?

I see the same behavior if I remove the commons-logging reference from 
the classpath, leaving just PdfBox and Log4j2.

Thanks,

Jerry

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


Re: what are pdfbox logging requirements?

Posted by Tilman Hausherr <TH...@t-online.de>.
I just attach the log4j 1.2.17 jar (i.e. the "old" log4j), a 
log4j.properties file and it works nicely.

I've never tried log4j2 because the "old" log4j does the job I need. (my 
car is several years old too, and I'm also keeping it as long as it 
doesn't have any annoying problems)

Maybe somebody else can help who has used log4j2 ?

Tilman


Am 06.04.2016 um 18:17 schrieb Jerry:
> I have a web app, which runs in tomcat8 using log4j2.  The app works 
> correctly.
>
> Now I am trying to add the ability to write a PDF file from the app, 
> using pdfbox-app-2.00.jar.
>
> First, I wrote a testbed program to verify that I can generate a valid 
> PDF.  In order to make it work, I downloaded  Apache's 
> commons-logging-1.2-bin.zip and added commons-logging-1.2.jar to the 
> testbed classpath.  That testbed now works.
>
> So now I'm trying to make it work within the webapp.
>
> I have added both the pdfbox and commons-logging jars to the webapps 
> classpath, and I have imported pdfbox classes into the app. The log4j 
> libraries are contained in the webapp's WEB-INF/lib folder.
>
> When I launch the app, I get a bunch of logging TRACE messages about 
> "trying to find" various forms of log4j2 properties, like the 
> follo0wing...
>
> TRACE StatusLogger Trying to find [log4j2-test/iBook.properties] using 
> context class loader WebappClassLoader
>   context: iBook
>   delegate: false
> ----------> Parent Classloader:
> java.net.URLClassLoader@42f30e0a
> .
>
> ...then an ERROR message that no log4j2 configuration could be found.
>
> There is a valid log4j2 configuration XML in tomcat's conf directory, 
> which the webapp is able to find and use.
>
> After these messages, the webapp starts.
>
> But as soon as I try to log in to the app, it fails, because it was 
> unable to authenticate the user (the app uses JAAS authentication, 
> which is apparently being blocked by the PdfBox/log4j2 problem).
>
> All of this happens only after I add PdfBox to the app, which 
> otherwise works fine.
>
> Do you have any insight to offer as to what might be the conflict?
>
> Are PdfBox and Log4j2 incompatible?
>
> I see the same behavior if I remove the commons-logging reference from 
> the classpath, leaving just PdfBox and Log4j2.
>
> Thanks,
>
> Jerry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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