You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Laurent Vanzeune <la...@s1.com> on 2001/02/21 16:59:05 UTC

EJB & log4j

Hi,

I know this question has already been asked some time ago but let me
insist. Are they any limitation/consideration using log4j in an EJB
environment ?

Laurent.


Re: EJB & log4j

Posted by Ceki Gülcü <cg...@qos.ch>.
Laurent,

Have you considered attaching a SocketAppender to the root category? The SocketAppender will send its output to a SocketServer. The SocketServer can apply any logging policy with the LoggingEvents it receives. It can log to multiple files, log errors here and debugs there, print on the console, do filtering, whatever. The point is: if you can do it locally then you can do it with a SocketAppender/SocketServer combination. 

The JMSAppender/JMSSink offer the same functionality. Cheers, Ceki

At 10:28 21.02.2001 -0600, you wrote:
>Laurent Vanzeune wrote:
>
>> Hi,
>>
>> I know this question has already been asked some time ago but let me
>> insist. Are they any limitation/consideration using log4j in an EJB
>> environment ?
>
>The biggest problem is that unless you are using something like the
>JMSAppender (messaging) or JDBCAppender (database), you have a tough time
>using an EJB as a front-end to Log4J.  What I mean is this:  a majority
>of people who use log4j will log messages to a file.  You may have many
>different types of files, one for error, one for trace/debug, one for
>warning, etc.  But the point is, you are logging to a single error file,
>not multiple.  So how do you log an error to an error log file within
>EJB?  You really can't use an EJB bean as your logging mechanism because
>of two reasons: 1) EJBs does not support singletons and 2) the
>specification states that file I/O is not allowed from a EJB bean.  This
>includes any Java classes callable from an EJB bean.  Neither of these
>are hard and fast rules because various EJB vendors have work arounds to
>support singletons and I have yet to see a vendor actually prevent you
>from doing file I/O.  Personally, what I do is when I start a project is
>I build either a CORBA or RMI singleton service (depending on what is
>supported by the EJB application server) that front's my log4j
>implmentation.
>
>--
>Perry Hoekstra
>E-Commerce Architect
>Talent Software Services
>perry.hoekstra@talentemail.com
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

----
Ceki Gülcü          Web:   http://qos.ch      
av. de Rumine 5     email: cgu@qos.ch (preferred)
CH-1005 Lausanne           ceki_gulcu@yahoo.com
Switzerland         Tel: ++41 21 351 23 15


Re: EJB & log4j

Posted by Perry Hoekstra <du...@uswest.net>.
Laurent Vanzeune wrote:

> Hi,
>
> I know this question has already been asked some time ago but let me
> insist. Are they any limitation/consideration using log4j in an EJB
> environment ?

The biggest problem is that unless you are using something like the
JMSAppender (messaging) or JDBCAppender (database), you have a tough time
using an EJB as a front-end to Log4J.  What I mean is this:  a majority
of people who use log4j will log messages to a file.  You may have many
different types of files, one for error, one for trace/debug, one for
warning, etc.  But the point is, you are logging to a single error file,
not multiple.  So how do you log an error to an error log file within
EJB?  You really can't use an EJB bean as your logging mechanism because
of two reasons: 1) EJBs does not support singletons and 2) the
specification states that file I/O is not allowed from a EJB bean.  This
includes any Java classes callable from an EJB bean.  Neither of these
are hard and fast rules because various EJB vendors have work arounds to
support singletons and I have yet to see a vendor actually prevent you
from doing file I/O.  Personally, what I do is when I start a project is
I build either a CORBA or RMI singleton service (depending on what is
supported by the EJB application server) that front's my log4j
implmentation.

--
Perry Hoekstra
E-Commerce Architect
Talent Software Services
perry.hoekstra@talentemail.com