Re: [logging] How to configure transitive Commons Logging dependency without affecting the entire Java environment?

2021-11-26 Thread Bernd Eckenfels
Hello,

Not sure how PDFBox works, but if you cannot specify a logger, than you will 
need to register a global common s logging SPI which in turn forwards the log 
events to your thread local logger. Or you use log4j impl, and then append such 
an Appender or Category to log4j.

Gruss
Bernd


--
http://bernd.eckenfels.net

Von: Bernhard Fey 
Gesendet: Friday, November 26, 2021 5:56:47 PM
An: user@commons.apache.org 
Betreff: [logging] How to configure transitive Commons Logging dependency 
without affecting the entire Java environment?

Hello,

While integrating PDFBox into our PDF library we ran into an issue with its 
usage of Commons Logging. During our research we only found ways to globally 
configure logging for the entire Java environment, which we cannot do:
Our use case is that our customers use our library in their Java environment to 
create PDFs and optionally merge them with existing PDFs. The latter is being 
migrated to use PDFBox.
Logging in our library is handled by a separate Java logger instance for each 
conversion. Multiple conversions can be executed at the same time, in different 
threads.
Our goal is to forward the log output of each PDFBox operation to the logger of 
the conversion that invoked it.
However, as we are shipping a library, to be used in an arbitrary Java 
environment, we cannot do any configuration that affects the entire 
environment, e.g. all Commons Logging loggers or all loggers used by PDFBox no 
matter if executed by our library or another one.

Thanks in advance.

Bernhard FeyProduct Development
Team Martha
- - - - - - - - - - - - - - - -
RealObjects GmbH
Altenkesseler Str. 17/B6
66115 Saarbrücken, Germany
Tel +49 (0)681 98579 0
Fax +49 (0)681 98579 29
http://www.realobjects.com
bernhard@realobjects.com
- - - - - - - - - - - - - - - -
Commercial Register: Amtsgericht Saarbrücken, HRB 12016
Managing Directors: Michael Jung, Markus Neurohr
VAT-ID: DE210373115



[logging] How to configure transitive Commons Logging dependency without affecting the entire Java environment?

2021-11-26 Thread Bernhard Fey
Hello,

While integrating PDFBox into our PDF library we ran into an issue with its 
usage of Commons Logging. During our research we only found ways to globally 
configure logging for the entire Java environment, which we cannot do:
Our use case is that our customers use our library in their Java environment to 
create PDFs and optionally merge them with existing PDFs. The latter is being 
migrated to use PDFBox.
Logging in our library is handled by a separate Java logger instance for each 
conversion. Multiple conversions can be executed at the same time, in different 
threads.
Our goal is to forward the log output of each PDFBox operation to the logger of 
the conversion that invoked it.
However, as we are shipping a library, to be used in an arbitrary Java 
environment, we cannot do any configuration that affects the entire 
environment, e.g. all Commons Logging loggers or all loggers used by PDFBox no 
matter if executed by our library or another one.

Thanks in advance.

Bernhard FeyProduct Development
Team Martha
- - - - - - - - - - - - - - - -
RealObjects GmbH
Altenkesseler Str. 17/B6
66115 Saarbrücken, Germany
Tel +49 (0)681 98579 0
Fax +49 (0)681 98579 29
http://www.realobjects.com
bernhard@realobjects.com
- - - - - - - - - - - - - - - -
Commercial Register: Amtsgericht Saarbrücken, HRB 12016
Managing Directors: Michael Jung, Markus Neurohr
VAT-ID: DE210373115