First, it's unusual to name your logger after the name of the log file you
expect it to go to. But I guess that's up to you. Your real problem is
probably that you haven't compile your classes with debug info (the java -g
option).
Jake
On Mon, 16 Jun 2008 12:11:37 +0530
"Debarshi Sanyal" <[EMAIL PROTECTED]> wrote:
Hi,
I wrote a small Java program to configure an org.apache.log4j.Logger and log
messages using it.
Excerpts from the Java file are:
package MyPackage;
//...
public class LogTest
{
private static Hashtable cLoggerHash = new Hashtable();
private void setLogInfo()
{
String sLogFile = "TestLogFile.log";
Logger cLogger = Logger.getLogger( sLogFile );
cLogger.setLevel( Level.toLevel("DEBUG") );
PatternLayout cLayout = new PatternLayout();
cLayout.setConversionPattern( "[%d{yyyy/MM/dd HH:mm:ss.SSS}]%C -
%m%n" );
RollingFileAppender cFileAppender = new RollingFileAppender();
//...
cFileAppender.activateOptions( );
cFileAppender.setLayout( cLayout );
cLogger.addAppender( cFileAppender );
cLoggerHash.put( sLogFile, cLogger );
}
public static void main (String[] args)
{
LogTest logTest = new LogTest();
logTest.setLogInfo();
Logger cLogger = Logger.getLogger( "TestLogFile.log" );
cLogger.log("TestLogFile.log", Level.INFO, "\t ++++++++++++++ This
is a test log +++++++++++++++++ ", null);
}
The output is:
[2008/06/13 20:24:53.415]? - ++++++++++++++ This is a test log
+++++++++++++++++
The fully qualified classname is NOT displayed.
Instead a "?" is displayed.
Please help.
Regards,
Debarshi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]