You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Mihai Nita (JIRA)" <ji...@apache.org> on 2018/11/10 02:12:00 UTC

[jira] [Comment Edited] (PDFBOX-4374) Switch from log4j to slf4j

    [ https://issues.apache.org/jira/browse/PDFBOX-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682146#comment-16682146 ] 

Mihai Nita edited comment on PDFBOX-4374 at 11/10/18 2:11 AM:
--------------------------------------------------------------

Thank you for the fast answer!

 

I am building something using maven (and that uses PDFBox).

And I am getting this:

log4j:WARN No appenders could be found for logger (org.apache.fontbox.ttf.PostScriptTable).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See [http://logging.apache.org/log4j/1.2/faq.html#noconfig] for more info.}}

 

Checking the PostScriptTable code it does use Apache commons, indeed.

Digging a bit more it looks like it somehow it brings with it org.apache.pdfbox:pdfbox-parent, and that lists log4j as a dependency
 (see [https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox-parent/2.0.12)]

Adding a log4.properties just for kicks and using format that starts with "log4j" I 

So it looks like the parent binds the Apache Commons Logging to log4j, hence the error message...
----
I was able to solve this using jcl-over-slf4j...

But this is really the problem these days... you build something with various libraries, and each one uses its own logging system.
 So you end up with a mixture of several, and it is a pain.
 In the last few years slf4j helped a lot, many libraries started to adopt it.

Somehow JCL seems left behind. The last release was in 2014, and can't be used with anything more modern like logback, or log4j 2.

Of course, it is 100% your call if you want to stay with it.
 I will still use PDFBox, as it is a great library, and I am grateful for it, thank you!

But if you think that slf4j seems like a good idea, my offer to do the migration stands :)

And if you want to close this issue, I am also fine.

Thank you very much,
 Mihai

 


was (Author: mnita_2000):
Thank you for the fast answer!

 

I am building something using maven (and that uses PDFBox).

And I am getting this:

{{log4j:WARN No appenders could be found for logger (org.apache.fontbox.ttf.PostScriptTable).}}
{{ log4j:WARN Please initialize the log4j system properly.}}
{{ log4j:WARN See [http://logging.apache.org/log4j/1.2/faq.html#noconfig] for more info.}}

 

Checking the PostScriptTable code it does use Apache commons, indeed.

Digging a bit more it looks like it somehow it brings with it org.apache.pdfbox:pdfbox-parent, and that lists log4j as a dependency
(see [https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox-parent/2.0.12)]

Adding a log4.properties just for kicks and using format that starts with "log4j" I 

So it looks like the parent binds the Apache Commons Logging to log4j, hence the error message...

----

I was able to solve this using jcl-over-slf4j...

But this is really the problem these days... you build something with various libraries, and each one uses its own logging system.
So you end up with a mixture of several, and it is a pain.
In the last few years slf4j helped a lot, many libraries started to adopt it.

Somehow JCL seems left behind. The last release was in 2014, and can't be used with anything more modern like logback, or log4j 2.

Of course, it is 100% your call if you want to stay with it.
I will still use PDFBox, as it is a great library, and I am grateful for it, thank you!

But if you think that slf4j seems like a good idea, my offer to do the migration stands :-)

And if you want to close this issue, I am also fine.

Thank you very much,
Mihai

 

> Switch from log4j to slf4j
> --------------------------
>
>                 Key: PDFBOX-4374
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4374
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>            Reporter: Mihai Nita
>            Priority: Critical
>
> Hello,
> I would be nice to use slf4j instead of relying explicitly on log4j. ([slf4j.org|http://slf4j.org])
> There are adapters from slf4j to many logger implementations, one of them is log4j.
> The decision of which log engine does not belong in a library, it belongs to the user of that library.
> This was apparently done already by several Apache projects. Searching for slf4j in Jira shows Zookeeper, HBase, HDFS, Parquet, Cloudstack, Nemo, EmpireDB, Oozie, Hadoop, and many others.
>  
> I can offer a patch, I have done such migration before.
> Thank you very much,
> Mihai
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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