I read from time to time that we should not use static variables in a bean session. Then, how should I get the logger for this bean and use it in all bean methods?
I think you interpret the "rule" too strictly.
You cannot store any servlet / session / bean state in a static variable, since this link is shared with all instances of this type.
( ) - . IMO Logger, / :
public class SomeTypeOfBean { private static final Logger log = Logger.getLogger(SomeTypeOfBean.class); //... }
( , ), , ( ).
, . ( , ).
, EJB - , , ( ). , , ( , , ). , , , , , .
You can just make it a non-stationary member.
Source: https://habr.com/ru/post/1713866/More articles:can you define a block with ruby line? - ruby | fooobar.comTrying to update google visualization using jquery - jqueryHow to import or create an Outlook 2003 (.rwz) rule with VSTO 2005? - vb.netГрафическая карта визуализации графической карты Google исчезает при ее обновлении? - javascriptPHP shows foreach output to the screen, for each element - ajaxAWTUtilities Transparent JFrame - javaUpdate Google visualization on the fly - javascriptDeserializing xml with namespace prefixes that are undefined - c #Filtering the result set of a stored procedure using the where clause - sql-serverHow to save an object with NHibernate, which consists of other complex types, but I only have the identifier of other complex types - c #All Articles