logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charith Fernando" <charith.ferna...@cslworld.com>
Subject RE: LOG4J messages printing twice
Date Mon, 24 Oct 2005 07:52:16 GMT
	static Logger logger = Logger.getLogger(Module.class);

	private void sendMailButtonAction()
	{
		SimpleLayout layout = new SimpleLayout();
		 FileAppender appender = null;
		 try
		 {
			 String fileName =
DateFormat.getDateInstance().format(new java.util.GregorianCalendar()
				 .getTime()) + "-LOG_FILE.txt";
			 System.out.println(fileName);
			 appender = new FileAppender(layout,fileName,true);
		 }
			catch(Exception e)
		 {
			 e.printStackTrace();
		 }

		 logger.addAppender(appender);
		 logger.setLevel((Level) Level.DEBUG);

		 logger.info(logger.getName());


this is the code segment used... can anyone suggest how to get over this
problem?

Thank you,
Regards,
Charith I. Fernando
+94 77 3263222 (Mobile)

-----Original Message-----
From: Charith Fernando [mailto:charith.fernando@cslworld.com] 
Sent: Monday, October 24, 2005 12:17 PM
To: 'Log4J Users List'
Subject: RE: LOG4J messages printing twice

    static Logger logger = Logger.getLogger(MessageSenderBean.class);

this is the code that I use to initialize the logger..... 

Thank you,
Regards,
Charith I. Fernando
+94 77 3263222 (Mobile)

-----Original Message-----
From: Charith Fernando [mailto:charith.fernando@cslworld.com] 
Sent: Monday, October 24, 2005 11:59 AM
To: 'Log4J Users List'
Subject: RE: LOG4J messages printing twice

I think the problem is the class gets called twice so the logger gets
initialized twice.. how can I solve this problem.

Thank you,
Regards,
Charith I. Fernando
+94 77 3263222 (Mobile)

-----Original Message-----
From: Charith Fernando [mailto:charith.fernando@cslworld.com] 
Sent: Monday, October 24, 2005 10:29 AM
To: 'Log4J Users List'
Subject: RE: LOG4J messages printing twice

Can u do this by having a static initializer?

Thank you,
Regards,
Charith I. Fernando
+94 77 3263222 (Mobile)

-----Original Message-----
From: Charith Fernando [mailto:charith.fernando@cslworld.com] 
Sent: Monday, October 24, 2005 10:19 AM
To: log4j-user@logging.apache.org
Subject: LOG4J messages printing twice

Hi all,

 

When my code runs the number of times it prints on the screen increases by 1
in each run.

 

I suspect that the loader gets registered more than once. whats the solution
for this?

 

Thank you,

Regards,

Charith I. Fernando

+94 77 3263222 (Mobile)

 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message