Re Log4j and EJB..

I have made a suggestion a couple of times that
seems to have fallen on completely deaf ears.
The suggestion is to create an appender that
forwards calls to the EJB container native log
methods.

Is there something wrong with this suggestion?
I am not currently an EJB user, so the following
is a bit vague, but it seems logical to me...

As I understand it, most (all?) EJB containers
already provide a log api, but that in most
cases it is pretty simplistic. I'm not even sure if 
there is a standard logging API or whether EJB 
containers provide proprietory methods.

An appender class which simply invokes the
native logging API on the EJB container seems
to me to be the perfect solution:
(a) the EJB container is responsible for actually
writing the message to disk, so there are no
access issues
(b) it should be very fast
(c) the EJB bean itself only uses log4j APIs,
so there are no proprietory calls in the beans.
(d) how logging is done can be reconfigured
via the log4j configuration file at any time, eg
to use SocketAppender/JDBCAppender.

I think to write such an appender will be about
4 lines of actual code.

Curiously,

Simon

> -----Original Message-----
> From: Pugh, Eric [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 27, 2001 5:04 PM
> To:   'LOG4J Users Mailing List'
> Subject:      RE: log4j, EJB, J2EE RI
> 
> So based on this, what is the easiest way to log for EJB's?
> 
> One of the things I liked about log4j was it's simplicty...  I am not
> really
> looking forward to using some of the other methods like JMSAppender etc...
> Next to the FileAppender, what is the simplest way of logging...  Database
> maybe?  
> 
> Could I create an Entity Bean that was an appender that would write to my
> database...?
> 
> Eric
> 
> -----Original Message-----
> From: John Brunton [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 27, 2001 9:41 AM
> To: LOG4J Users Mailing List
> Subject: RE: log4j, EJB, J2EE RI
> 
> 
> The application accessing the EJB stops with an exception:
> 
> java.rmi.ServerException: RemoteException occurred in server thread;
> nested
> exception is:
>       java.rmi.RemoteException: Unknown exception: ; nested exception is:
> java.rmi.ExceptionInInitializerError
> java.rmi.RemoteException: Unknown exception: ; nested exception is:
>       java.lang.ExceptionInInitializerError:
> java.security.AccessControlException:
>       access denied (java.io.FilePermission E:/dev/log4j/Root.log write)
> 
> I suppose you could change the permissions in the java.policy file to
> allow
> writes to the log files.
> 
> But, I don't think that would be a good idea.
> 
> (It would be very easy to start down that path...)
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Pugh, Eric [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 27, 2001 8:59 AM
> To: 'LOG4J Users Mailing List'
> Subject: RE: log4j, EJB, J2EE RI
> 
> 
> When you get fileaccess errors...  Does the EJB have problems, or just
> logging?
> 
> I am using FileAppender in a bunch of non EJB applications...  I want to
> add
> it to some EJB objects, and I don't mind if a message gets lost here or
> there....  The app doesn't get a lot of use, so the chances of two
> people/processes trying to write to the same file is fairly low....
> 
> So, does the logger fail cleanly, or does it fail messily?
> 
> Eric
> 
> -----Original Message-----
> From: Kitching Simon [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 27, 2001 4:38 AM
> To: 'LOG4J Users Mailing List'
> Subject: RE: log4j, EJB, J2EE RI
> 
> 
> Hi John,
> 
> It has been mentioned several times
> on this list that the FileAppender really
> shouldn't be used for EJB development.
> FileAppender isn't designed for
> multiple processes writing to the
> same file, and (as you have seen)
> there are also security/access issues
> with creating a file on disk.
> 
> I suggest using the SocketAppender,
> JMSAppender, DatagramStringAppender
> (see contribs dir), or write an appender
> that forwards log messages to the
> logging api that comes with your EJB engine.
> 
> Note that I haven't used log4j with EJBs myself .
> 
> Regards,
> 
> Simon
> 
> > -----Original Message-----
> > From:       John Brunton [SMTP:[EMAIL PROTECTED]]
> > Sent:       Monday, February 26, 2001 10:59 PM
> > To: log4j-user @jakarta.apache.org
> > Subject:    log4j, EJB, J2EE RI
> >
> > Being new to the log4j community, I find using log4j a little difficult
> at
> > times. At present, I am able to log messages, etc using the
> FileAppender,
> > except from within an EJB running under the J2EE RI. I get the dreaded
> > java.security.AccessControlException: access denied for my log file.
> >
> > What are my options as I need to be able to log from within an EJB?
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to