I have a stand alone class. I have to provide a logging mechanism for this file to log all the process taking place including exceptions. Later this would get integrated with a jar or so. What is the best logging mechanism which would be compatible even after integration. Since mine is just a class file which is not included in a jar, is it possible to use log4J? more suggestions welcome.
Share
You might want to use LogBack as an implementation of the generic slf4j framework. Note that log4j is an implementation of slf4j as well and this mean that if you program to the slf4 interface you can exchange logback and log4j by just replacing one jar with the other. Go with the first baby steps and note the generic imports of this introduction link. With logback you can instruct your app where to locate the configuration file with the following:
-Dlogback.configurationFile=path/filename.extThe exception that you’re receiving (described in your comment) means that you probably did not configure log4j or that your app couldn’t locate the configuration file.
Writing your own logger class or using the one provided by the util package is prob ably not a good idea..