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 Sachin Wadhwa <sw...@dwl.com> on 2001/04/04 23:06:08 UTC

EJB problem

Hi All,
I have a class called "A" . This class A has a  variable cat:category.
It logs using Fileappender (writes to a file).
Now A calls a session Bean "SB". This session bean has another variable
SB_cat:category. In one of the methods of SB there is a statement
SB_cat.warn("I am in Session Bean");
But this statement is not printed in the file. rather I get the error
that Appender not attached. Why do I need to attach an appender when I
allready have BasicConfigurator(appender) in class A.
Can anyone please suggest how to use log4j in Beans
THanks
Sac

--
Sachin Wadhwa
Product Developer
DWL Incorporated
230 Richmond Street East Level 2
Toronto, ON
M5A 3X9
T: (416)364-2045 x 2463
F: (416)364-2422
www.dwl.com



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: EJB problem

Posted by Robert Burrell Donkin <Ro...@appleonline.net>.
Sachin Wadhwa wrote:

> Thanks Martin,
> But I am still not very sure how to use the FileAppender with the Session
> Bean. There is a new thread that is dispatched every time I try to write to
> the log with File appender. and it doesn't write to file properly.

at the risk of sounding like a broken record, have you specified an absolute
path for your log?
if not, check the archives.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: EJB problem

Posted by Sachin Wadhwa <sw...@dwl.com>.
Thanks Martin,
But I am still not very sure how to use the FileAppender with the Session
Bean. There is a new thread that is dispatched every time I try to write to
the log with File appender. and it doesn't write to file properly. Do you
have any sample code .
 Session Beans category variable uses the root as its parent but the aai
variable of the parent is null. and when I try to call
BasicConfigure(Fileappender) in the session Bean , it doesn't write properly.

THanks
Sac

Martin Diener wrote:

> Well,
>
> logging in EJBs is a little tricky and depends on the EJB container
> implementation. According to Sun's EJB spec a EJB is not able
> to write in a file. Unfortunatly, there are a few impementations
> which don't behave like the spec. If you decide to use this bug, say
> good by to portability.
> But this is not a problem for log4j. I have good experiences with
> several EJB Containers using the syslog appender. Others work
> with the socket appender. (Don't get confused with the sun spec here -
> you can't write a EJB acting as server using a dedicated socket. But
> logging is done in the client role - that's fine.)
> I did a few experiments with the JMS appender. The appender itself
> looks great, but the JMS implementation I used was realy bad. You
> can manage it, but be prepared to learn a lot about JMS.
>
> This hints hopefully help
> Martin Diener
>
> Am Mittwoch,  4. April 2001 23:06 schrieben Sie:
> > Hi All,
> > I have a class called "A" . This class A has a  variable cat:category.
> > It logs using Fileappender (writes to a file).
> > Now A calls a session Bean "SB". This session bean has another variable
> > SB_cat:category. In one of the methods of SB there is a statement
> > SB_cat.warn("I am in Session Bean");
> > But this statement is not printed in the file. rather I get the error
> > that Appender not attached. Why do I need to attach an appender when I
> > allready have BasicConfigurator(appender) in class A.
> > Can anyone please suggest how to use log4j in Beans
> > THanks
> > Sac
> >
> > --
> > Sachin Wadhwa
> > Product Developer
> > DWL Incorporated
> > 230 Richmond Street East Level 2
> > Toronto, ON
> > M5A 3X9
> > T: (416)364-2045 x 2463
> > F: (416)364-2422
> > www.dwl.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

--
Sachin Wadhwa
Product Developer
DWL Incorporated
230 Richmond Street East Level 2
Toronto, ON
M5A 3X9
T: (416)364-2045 x 2463
F: (416)364-2422
www.dwl.com



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: EJB problem

Posted by Martin Diener <ma...@diener.com>.
Well,

logging in EJBs is a little tricky and depends on the EJB container
implementation. According to Sun's EJB spec a EJB is not able
to write in a file. Unfortunatly, there are a few impementations 
which don't behave like the spec. If you decide to use this bug, say
good by to portability.
But this is not a problem for log4j. I have good experiences with
several EJB Containers using the syslog appender. Others work
with the socket appender. (Don't get confused with the sun spec here -
you can't write a EJB acting as server using a dedicated socket. But
logging is done in the client role - that's fine.)
I did a few experiments with the JMS appender. The appender itself
looks great, but the JMS implementation I used was realy bad. You
can manage it, but be prepared to learn a lot about JMS.

This hints hopefully help
Martin Diener


Am Mittwoch,  4. April 2001 23:06 schrieben Sie:
> Hi All,
> I have a class called "A" . This class A has a  variable cat:category.
> It logs using Fileappender (writes to a file).
> Now A calls a session Bean "SB". This session bean has another variable
> SB_cat:category. In one of the methods of SB there is a statement
> SB_cat.warn("I am in Session Bean");
> But this statement is not printed in the file. rather I get the error
> that Appender not attached. Why do I need to attach an appender when I
> allready have BasicConfigurator(appender) in class A.
> Can anyone please suggest how to use log4j in Beans
> THanks
> Sac
>
> --
> Sachin Wadhwa
> Product Developer
> DWL Incorporated
> 230 Richmond Street East Level 2
> Toronto, ON
> M5A 3X9
> T: (416)364-2045 x 2463
> F: (416)364-2422
> www.dwl.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org