Surprises? Interesting! Please do tell/clarify/elaborate or provide some examples of surprises.
So far, I have not seen any surprises at all. Okay, never mind. I took the liberty to search google for: static Logger logger = LoggerFactory and found this[1], which makes it abundantly clear why I should define the logger as 'static'. As always, thanks Romain! [1] http://stackoverflow.com/questions/6653520/why-do-we-declare-loggers-static-final On Mon, Jan 13, 2014 at 1:58 AM, Romain Manni-Bucau <[email protected]>wrote: > @Howard: make it static otherwise you can get surprises :p > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > > 2014/1/13 Howard W. Smith, Jr. <[email protected]>: > > On Sun, Jan 12, 2014 at 11:44 AM, Romain Manni-Bucau > > <[email protected]>wrote: > > > >> Side note: producing a logger is a wrong idea (see codi list to learn > >> why) so maybe just get rid of it > >> > > > > +1 > > > > My SLF4J example below. > > > > > > import org.slf4j.Logger; > > import org.slf4j.LoggerFactory; > > > > @Named("myController") > > @SessionScoped > > public class MyController implements Serializable { > > > > private final Logger logger = LoggerFactory.getLogger(getClass()); > > > > // of course, this is inside some method > > try { > > ... > > } catch (Exception e) { > > logger.error("caught exception:", e); > > } >
