Use different logger

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Use different logger

Michal Stehlik
Hi,

I use log4j2 logger and wanted to redirect POI to this logger. Web says I
should implement class that would implement interface POILogger.
Unfortunatelly, POILogger is not interface - it is abstract class with
package private constructor, and thus cannot be subclassed without forking
POI project.

Is it possible to either add simple wrapper for using log4j2, or make
POILogger constructor public to enable its subclassing outside
org.apache.poi.util package?

Kind regards,
                Michal
Reply | Threaded
Open this post in threaded view
|

Re: Use different logger

pj.fanning
Have a look at
https://github.com/apache/poi/blob/trunk/src/java/org/apache/poi/util/POILogFactory.java#L74

You can use the system property "org.apache.poi.util.POILogger" to provide a
class name of an alternate implementation of org.apache.poi.util.POILogger.
The new class will need to sublass org.apache.poi.util.POILogger.

https://github.com/apache/poi/blob/trunk/src/java/org/apache/poi/util/SystemOutLogger.java
is an example.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Use different logger

kiwiwings
On 31.12.18 11:30, pj.fanning wrote:
> The new class will need to sublass org.apache.poi.util.POILogger.
>
But the problem is, that the new logger needs to reside in the same package.
I would remove the package-private constructor or make POILogger an interface.

Andi


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Use different logger

pj.fanning
I forgot about POILogger constructor issue - I raised
https://bz.apache.org/bugzilla/show_bug.cgi?id=63047 - an ugly workaround is
to create the custom logger in the `org.apache.poi.util` package for now.

I'd like us to consider https://bz.apache.org/bugzilla/show_bug.cgi?id=63047
in the medium term.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Use different logger

pj.fanning
In reply to this post by kiwiwings
I meant https://bz.apache.org/bugzilla/show_bug.cgi?id=63046 as the medium
term solution.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]