I am using logback but, rather than having the logger class called directly, I would like to have a custom class/wrapper class which logs the data. (This is required by the usecase). I would like to print the source class names which are calling this wrapper class rather than the wrapper class. I tried logging with this class but its always printing the className of the wrapper class.
class MyAppLogTest {
public static void main(String args[]) {
String msg="Some Msg";
ApplicationLogger.logData( "MyAppLogTest", "main",msg);
}
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class ApplicationLogger {
private static Logger logger = null;
static {
logger = (Logger) LoggerFactory.getLogger(ApplicationLogger.class);
}
public static void logData(final String clazz, final String method,final String msg) {
logger.info(msg);
}
}
Regards