Hi Neil, That's okay the more people take an interest in this the better it will be. We did discuss this quite a bit ago at a biojava meeting & the general consensus was bridges can be manually written between the logging frameworks as and when they are required. Also using the JDK logger reduces our external dependencies.
However I do like the logging facades & am in favour of them. Especially SLF4J which does the same thing as commons-logging but relies on the existence of SLF4J adaptors not the raw logging framework which commons-logging does. It also has links to a lot more logging frameworks including simple-log (https://simple-log.dev.java.net/) & logback (http://logback.qos.ch/). There's just so many options here it's hard to gauge what is the best thing to do. Do we buy into a single framework & use all of its features (JDK logger has nice things for logging entering & exiting methods along with locale ResourceBundles) or go for a common denominator. It's not an easy decision to make ........ Andy Neil Benn wrote: > Hello, > > I'm not sure if I should comment as I have no time to > contribute LOC but I thought I may as well ;). > > Mark Schreiber wrote: >> Hi - >> >> I would like to strongly advocate the liberal and extensive use of >> Logging in BioJava3. The lack of this plagued us (me at least) during >> bug fixes in previous versions of BioJava. The default Java logging >> API is very flexible and easily meets our needs. It's also not too >> much effort for developers to put in place (you know you use >> System.println() all over the place anyway). >> > Hmm, that is true but for total completeness you can use > commons-logging, that is very easy to use and much more flexible as it > can encapsulate other logging mechanisms (including JDK1.4 logging > framework). To use it you simply declare a new logger as follows: > > private static final Log logger = LogFactory.getLog(<Insert classname > here>); > > The rest of it works pretty much the same as below- if you dovetail > commons-logging with log4j then you'll cover the most common case of > logging used in other frameworks - the config files to setup log4j (XML > and preperties fiels) are well documented all over the web. >> <snip> >> >> I know from experience we will definitely get the most value from this >> in the IO parsers and ThingBuilders. >> >> Any thoughts? >> > +1 >> - Mark >> >> >> >> private Logger logger = Logger.getLogger("org.biojava.MyClass"); >> >> public Object generateObject(String argument){ >> logger.entering(""+getClass(), "generateObject", argument); >> >> //expensive logging operation >> if (logger.isLoggable( Level.CONFIG )) { >> logger.config("DB config: "+ getDBConfigInfo()); >> } >> >> Object obj = null; >> try{ >> >> //do some stuff >> logger.fine("doing stuff"); >> obj = new Object(); >> >> }catch(Exception ex){ >> logger.severe("Failed to do stuff"); >> logger.throwing(""+getClass(), "generateObject", ex); >> } >> >> logger.exiting(""+getClass(), "generateObject", obj); >> return obj; >> } >> _______________________________________________ >> Biojava-l mailing list - [email protected] >> http://lists.open-bio.org/mailman/listinfo/biojava-l >> > > _______________________________________________ > Biojava-l mailing list - [email protected] > http://lists.open-bio.org/mailman/listinfo/biojava-l _______________________________________________ Biojava-l mailing list - [email protected] http://lists.open-bio.org/mailman/listinfo/biojava-l
