You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2013/09/20 09:52:42 UTC

Logger producer in tomEE cluster

Hi,
I've got a question, maybe more relatred to slf4j, but maybe someone has a
clue on what's happening:
I have a TomEE cluster:
openejb.session-context = http 
tomee.session-context.wrapper = http
and tomcat has the tcp cluster configured.


I want to produce loggers in my project, so I made a producer:

    @Produces
    public Logger getLogger(final InjectionPoint injectionPoint) {
        return
LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass());
    }

so in any of my cdi beans (viewaccessscoped impl Serializable) I do:
@Inject
 private transient Logger LOG;

However, in the logs I see:
java.io.NotSerializableException: cannot serialize Logger, Name:null,
WebBeans Type:PRODUCERMETHOD, API Types:[org.slf4j.Logger,java.lang.Object],
Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]

No issues running on standalone TomEE.

TomEE 1.6.0-PLUS-SNAPSHOT

best regards
hw




--
View this message in context: http://openejb.979440.n4.nabble.com/Logger-producer-in-tomEE-cluster-tp4665176.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Logger producer in tomEE cluster

Posted by hwaastad <he...@waastad.org>.
I belive I have,

I've testet all kinds of configuration and I think I'll revert back to
static loggers again :-|

anyway,
thanks a lot.



--
View this message in context: http://openejb.979440.n4.nabble.com/Logger-producer-in-tomEE-cluster-tp4665176p4665178.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Logger producer in tomEE cluster

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

did you try to create proxy on Serializable and Logger in your producer to
ensure you can recreate your logger is serialized? otherwise the logger is
not serializable so it fails that's normal.

Side note: in a lot of projects produced loggers are replaced by static
loggers cause of it.

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/20 hwaastad <he...@waastad.org>

> Hi,
> I've got a question, maybe more relatred to slf4j, but maybe someone has a
> clue on what's happening:
> I have a TomEE cluster:
> openejb.session-context = http
> tomee.session-context.wrapper = http
> and tomcat has the tcp cluster configured.
>
>
> I want to produce loggers in my project, so I made a producer:
>
>     @Produces
>     public Logger getLogger(final InjectionPoint injectionPoint) {
>         return
> LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass());
>     }
>
> so in any of my cdi beans (viewaccessscoped impl Serializable) I do:
> @Inject
>  private transient Logger LOG;
>
> However, in the logs I see:
> java.io.NotSerializableException: cannot serialize Logger, Name:null,
> WebBeans Type:PRODUCERMETHOD, API
> Types:[org.slf4j.Logger,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]
>
> No issues running on standalone TomEE.
>
> TomEE 1.6.0-PLUS-SNAPSHOT
>
> best regards
> hw
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Logger-producer-in-tomEE-cluster-tp4665176.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>