I just read the old website documentation for the (deprecated??) logging library - discussing uses ogf "logging" like tracing, debugging, logging: http://qi4j.org/2.0/library-logging.html
Tracing is pretty simple in qi4j. "Logging" refers to something like application events. Debugging is .... well the small weird messages we always wished we put into our code, but didn't, so we put it into the code for the next release, look at it after the release and then never look at that logging again. Maybe there is simply not much left? Some sort of event mechanism has already been mentioned in this discussion. Maybe we do not need general-purpose logging, but rather application events coupled with an efficient implementation when noone is listening (that part most logging libraries does really well) ? Niclas is not far from that, when considering focused methods instead of general-purpose methods in a logging API. Implementations could then choose to log (to file system, some database audit log or send to a JMS Queue, whatever). We could choose to provide a default implementation debug logging everything using java.util.logging, thus avoiding external dependencies. Of course there would be challenges to avoid excessive work "when noone listens" - but application events have been discussed years ago (i think without being solved) - maybe it is about time to look at that again? /Kent Den 31-03-2015 kl. 11:15 skrev Niclas Hedhman: > On Tue, Mar 31, 2015 at 11:18 AM, James Carman <[email protected]> > wrote: > >> What do you do when there is no logger? Use >> a default no-op implementation or something? > > Some basic training for our new friends; > > If I have > > public interface Abc > { > int doSomething(); > void somethingElse(); > : > } > > I can during bootstrap do; > > public void assemble( ModuleAssembly module ) // you implement, called by > Qi4j > throws AssemblyException > { > module.services( Abc.class ).withMixins( NoopMixin.class ); > } > > And I have a Noop implementation of the Abc service. Nothing else is > needed. ;-) > > or, I can do; > > public void assemble( ModuleAssembly module ) // you implement, called by > Qi4j > throws AssemblyException > { > if( Boolean.getBoolean( "enableAbcAll" ) ) > module.services( Abc.class ).withMixins( DoSomethingMixin.class, > SomethingElseMixin.class ); > if( Boolean.getBoolean( "enableAbcDoSomething" ) ) > module.services( Abc.class ).withMixins( DoSomethingMixin.class ); > if( Boolean.getBoolean( "enableAbcSomethingElse" ) ) > module.services( Abc.class ).withMixins( SomethingElseMixin.class ); > module.services( Abc.class ).withMixins( NoopMixin.class ); > } > > If I want to allow each method to be enable individually with an > implementation. The last NoopMixin registration basically says; "And for > everything else use Noop". > > For extensions working straight on Core itself, it is not as sweet, but it > has been done with Metrics. Possibly, the design for this will get an > upgrade at the same time.... > > > Hope you find that intriguing... > > > Cheers
