I'm not sure if this is an slf4j or a logback question. I have a library that 
would like to configure logging :) , but only in a way that is optional for 
users to use when making stand alone applications. Managing separate 
logback.xml files is tedious and many of the users of the library don't want to 
be bothered with this. Instead I interface, LoggingOption that they can use 
with JCommander (a command line parser), they then set this up however is 
appropriate (ConsoleOnlyLoggingOptions), (ComplexLoggingOptions), 
(SingleFileLoggingOptions), each one of these exposes command line arguments 
that are set as system properties to custom logback.xml files. It's expected 
that if the user overrides the logback.xml file that these options have no 
effect and that is okay.

 

When everything is ready, the users call LoggingOptions.initializeLogging() and 
the system properties are set and the first Logger is retrieved. The problem I 
have is occasionally a sneak logger has been constructed before hand. I am 
looking for a portable (logback agnostic way), to detect this condition. I 
don't control the main() methods or anything. Is there something I can access 
in the SLF4J API that would tell me a logger has already been retrieved? I 
don't need to do anything but print a friendly warning.

 

Thanks,

 

Steve Ramage

 
_______________________________________________
slf4j-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/slf4j-user

Reply via email to