Re: Questions on initial log4j instance
Yes, of course 'volatile' not 'transient'. I somehow merged volatile and transient in my mind. At 09:50 AM 9/29/2003 -0700, Kevin Klinemeier wrote: Do you mean 'volatile' here? I can't find in the JLS where transient has this affect. It wouldn't be the first time I've looked for something in the JLS and not found it, though. -Kevin --- Ceki Gülcü <[EMAIL PROTECTED]> wrote: > Moreover, in addition to serialization aspects, the keyword > 'transient' has > other meanings. It forces the JVM to re-reread the value of the > variable > from memory for each access, adding unnecessary overhead. -- Ceki Gülcü For log4j documentation consider "The complete log4j manual" ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Questions on initial log4j instance
Do you mean 'volatile' here? I can't find in the JLS where transient has this affect. It wouldn't be the first time I've looked for something in the JLS and not found it, though. -Kevin --- Ceki Gülcü <[EMAIL PROTECTED]> wrote: > Moreover, in addition to serialization aspects, the keyword > 'transient' has > other meanings. It forces the JVM to re-reread the value of the > variable > from memory for each access, adding unnecessary overhead. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Questions on initial log4j instance
Howdy, I hate to be such a nitpick on this, and it's a matter of style only not substance, but in case you care, things that are static final should be capitalized, so if you have a private static final Logger it should be private static final Logger LOGGER = Logger.getLogger("some.name"); If you leave it as logger (lower case), obviously it still works fine but tools like Checkstyle complain. Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Ceki Gülcü [mailto:[EMAIL PROTECTED] >Sent: Monday, September 29, 2003 11:41 AM >To: Log4J Users List >Subject: Re: Questions on initial log4j instance > >At 04:58 PM 9/29/2003 +0800, Yu Xiang Xi (Maveo) wrote: >>I have seen different usage of initial log4j instance like below >>private final static Logger logger = Logger.getLogger("some.name"); > >looks good. > >> and >>private final transient static Logger logger = >>Logger.getLogger("some.name"); >>the second one has a additional keyword transient. > >Loggers cannot be serialized so marking them transient can be useful for >non static loggers. > >However, since static variables are not serialized, there is no need to >mark them as transient. > >Moreover, in addition to serialization aspects, the keyword 'transient' has >other meanings. It forces the JVM to re-reread the value of the variable >from memory for each access, adding unnecessary overhead. > >>Which way is recommended? > >The recommended form is: > > private static final Logger logger = ... > > >>Thanks in advance. >> >>Best Regards >>Xi Yuxiang >>Maveo Systems Limited > >-- >Ceki Gülcü > > For log4j documentation consider "The complete log4j manual" > ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp > > import org.apache.Facetime; > ApacheCon US 2003, 18-21 November http://apachecon.com/ > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Questions on initial log4j instance
At 04:58 PM 9/29/2003 +0800, Yu Xiang Xi (Maveo) wrote: I have seen different usage of initial log4j instance like below private final static Logger logger = Logger.getLogger("some.name"); looks good. and private final transient static Logger logger = Logger.getLogger("some.name"); the second one has a additional keyword transient. Loggers cannot be serialized so marking them transient can be useful for non static loggers. However, since static variables are not serialized, there is no need to mark them as transient. Moreover, in addition to serialization aspects, the keyword 'transient' has other meanings. It forces the JVM to re-reread the value of the variable from memory for each access, adding unnecessary overhead. Which way is recommended? The recommended form is: private static final Logger logger = ... Thanks in advance. Best Regards Xi Yuxiang Maveo Systems Limited -- Ceki Gülcü For log4j documentation consider "The complete log4j manual" ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp import org.apache.Facetime; ApacheCon US 2003, 18-21 November http://apachecon.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Questions on initial log4j instance
Agree -- private static final Logger is what I recommend. Modifiers are static then final, not vice versa. JLS section 8.3.1 defines the production FieldModifier: one of public protected private static final transient volatile and states, "If two or more (distinct) field modifiers appear in a field declaration, it is customary, though not required, that they appear in the order consistent with that shown above in the production for FieldModifier." WRT to serialization, declaring a field both static and transient is redundant as static fields are not serialized by definition. Jim -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 7:55 AM To: Log4J Users List Subject: RE: Questions on initial log4j instance Howdy, Where did you see the transient one? The perfect syntax depends on your usage of the Logger. The most common one I think, as well as the one most frequently illustrated in the log4j documentation, is private final static (which should be private static final according to JLS recommendations ;)) Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Yu Xiang Xi (Maveo) [mailto:[EMAIL PROTECTED] >Sent: Monday, September 29, 2003 4:58 AM >To: 'Log4J Users List' >Subject: Questions on initial log4j instance > >I have seen different usage of initial log4j instance like below >private final static Logger logger = Logger.getLogger("some.name"); > and >private final transient static Logger logger = >Logger.getLogger("some.name"); >the second one has a additional keyword transient. > >Which way is recommended? >Thanks in advance. > >Best Regards >Xi Yuxiang >Maveo Systems Limited > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Confidentiality Warning: This e-mail contains information intended only for the use of the individual or entity named above. If the reader of this e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, any dissemination, publication or copying of this e-mail is strictly prohibited. The sender does not accept any responsibility for any loss, disruption or damage to your data or computer system that may occur while using data contained in, or transmitted with, this e-mail. If you have received this e-mail in error, please immediately notify us by return e-mail. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Questions on initial log4j instance
Howdy, Where did you see the transient one? The perfect syntax depends on your usage of the Logger. The most common one I think, as well as the one most frequently illustrated in the log4j documentation, is private final static (which should be private static final according to JLS recommendations ;)) Yoav Shapira Millennium ChemInformatics >-Original Message- >From: Yu Xiang Xi (Maveo) [mailto:[EMAIL PROTECTED] >Sent: Monday, September 29, 2003 4:58 AM >To: 'Log4J Users List' >Subject: Questions on initial log4j instance > >I have seen different usage of initial log4j instance like below >private final static Logger logger = Logger.getLogger("some.name"); > and >private final transient static Logger logger = >Logger.getLogger("some.name"); >the second one has a additional keyword transient. > >Which way is recommended? >Thanks in advance. > >Best Regards >Xi Yuxiang >Maveo Systems Limited > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]