is Logger serializable?
Hello - I am a brand new log4j user so this is probably a stupid question, but is a Logger meant to be serializable? Or should I mark Logger instance variables in my serializable bean classes as transient? The Serializable interface isn't on Logger. Thanks, -- Anna Battenhouse Internet Applications Architect CCITRIAD, Inc. 804 Las Cimas Parkway, Suite 200 Austin TX 78746 (512) 278-5524 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is Logger serializable?
If you make them class static variables, it is the same as marking them as transient. The recommended way to define a logger is probably private static final Logger logger = Logger.getLogger(MyClass.class.getName()); This will not be serialized. If you don't make it static, then do... private transient final Logger logger = Logger.getLogger(DBRApplicationGateway.class.getName()); Jake At 06:03 PM 4/2/2003 -0600, you wrote: Hello - I am a brand new log4j user so this is probably a stupid question, but is a Logger meant to be serializable? Or should I mark Logger instance variables in my serializable bean classes as transient? The Serializable interface isn't on Logger. Thanks, -- Anna Battenhouse Internet Applications Architect CCITRIAD, Inc. 804 Las Cimas Parkway, Suite 200 Austin TX 78746 (512) 278-5524 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logger serializable?
Hi, Much like are my beloved Patriots going to win the SuperBowl again?, the answer to your question is almost definitely no. Logger is not serializable. You can easily and quickly tell that from the JavaDoc, at: http://jakarta.apache.org/log4j/docs/api/index.html (class Logger or an ancestor would have to implement java.io.Serializable and I don't think it does). Your use-case is interesting. Why did you want to put the loggers into JNDI? Yoav Shapira Millennium ChemInformatics -Original Message- From: Ryan Cuprak [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 11:26 AM To: Log4J Users List Subject: Logger serializable? Just out of curiosity - are loggers serializable? In other words, can they be safely put into jndi? I was going to setup the loggers for my EJBs in Mbeans and put the loggers into jndi (using jboss). -Ryan --- --- Ryan Cuprak Software Developer Eastman Kodak www.cuprak.net Cell: (203)-376-8789 [EMAIL PROTECTED]Office: (203)-786-5682 [EMAIL PROTECTED] Home: (203)-407-8267 AIM: rcupr --- --- -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logger serializable?
Thanks for the reply. I was going to put the loggers into jndi so that I could gain access to them from within my EJBs. I know that Jboss does have built-in jboss support but I am trying to keep my EJBs pure so that I would not be tied to one app server (actually a constraint on my project). I also wanted to manage the logging via mbeans. Right now I don't see any clear way to use log4j in enterprise beans and easily manage the logging at run time. -Ryan Cuprak On 8/21/02 11:38 AM, Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Much like are my beloved Patriots going to win the SuperBowl again?, the answer to your question is almost definitely no. Logger is not serializable. You can easily and quickly tell that from the JavaDoc, at: http://jakarta.apache.org/log4j/docs/api/index.html (class Logger or an ancestor would have to implement java.io.Serializable and I don't think it does). Your use-case is interesting. Why did you want to put the loggers into JNDI? Yoav Shapira Millennium ChemInformatics -Original Message- From: Ryan Cuprak [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 11:26 AM To: Log4J Users List Subject: Logger serializable? Just out of curiosity - are loggers serializable? In other words, can they be safely put into jndi? I was going to setup the loggers for my EJBs in Mbeans and put the loggers into jndi (using jboss). -Ryan --- --- Ryan Cuprak Software Developer Eastman Kodak www.cuprak.net Cell: (203)-376-8789 [EMAIL PROTECTED]Office: (203)-786-5682 [EMAIL PROTECTED] Home: (203)-407-8267 AIM: rcupr --- --- -- To unsubscribe, e-mail: mailto:log4j-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:log4j-user- [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ryan Cuprak Software Developer Eastman Kodak www.cuprak.net Cell: (203)-376-8789 [EMAIL PROTECTED]Office: (203)-786-5682 [EMAIL PROTECTED] Home: (203)-407-8267 AIM: rcupr -- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logger serializable?
Hi, but I am trying to keep my EJBs pure so that I would not be tied to one app server (actually a constraint on my project). I also wanted to manage the logging via mbeans. Right now I don't see any clear way to use log4j in enterprise beans and easily manage the logging at run time. Here's what we do: - Obtain loggers in the simplest way: Logger.getLogger(Foo.class.getName()); - Use loggers normally within the beans. - We wrote a simple servlet that lets you name a package / class and set the logging level for it. This servlet is really very simple and easy to write. Only two form fields (class name and logging level) and a submit button for the UI. Very simple logger = Logger.getLogger(whatever was specified in the class name field) and logger.setLevel(whatever was specified in the level field). This has worked for us for runtime changes in tomcat standalone, JBoss-tomcat, and JBoss-Jetty, without any container problems (because of course this approach is container-independent). I think the MBean is a nice solution as well, but it may be a bit harder to implement. We also didn't want to tie ourselves to a container that supports JMX, because at the time we developed this JMX support wasn't to be taken for granted ;) Maybe it will work for you too. Good luck, Yoav Shapira Millennium ChemInformatics This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logger serializable?
I was going to put the loggers into jndi so that I could gain access to them from within my EJBs. I know that Jboss does have built-in jboss support but I am trying to keep my EJBs pure so that I would not be tied to one app server (actually a constraint on my project). Another possibility would be to create your own logger class with abstract methods such as info, debug etc. Provide a static factory method getInstance(name : String) that returns a subclass of your logger (possibly after looking up the class name via JNDI) that works as a wrapper for a log4j (or whatever) logger. -- Eric Jain -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]