Hello all im using the log4j logger , but now i like to do generic Logger to my application and encapsulate all the log4j initial data it needed in some generic Logger class my first proablem is for example if i call from my class this generic Logger how can it know my class name whiteout passing it the "MyClass.class" as parameter so log4j could use this information?
Then you wouldn't need to pass the class name along.
Your logging class could also examine the current stack trace, where the second-but-last entry would be the calling class and method. You can get the stack trace via "new Throwable().getStackTrace()".
But why do you want to roll your own logging abstraction, when something like Jakarta Commons Logging is available, which can wrap java.util.logging, log4j, and other logging implementations? [ November 12, 2006: Message edited by: Ulf Dittmer ]