Why a new instance uses logger from old instances?
Posted
by Roman
on Stack Overflow
See other posts from Stack Overflow
or by Roman
Published on 2010-04-20T14:47:55Z
Indexed on
2010/04/20
14:53 UTC
Read the original article
Hit count: 188
I generate 2 instances in this way:
gameManager manager1 = new CTManager(owner,players1,"en");
manager1.start();
gameManager manager2 = new CTManager(owner,players2,"en");
manager2.start();
The start()
method of the gameManager looks like that:
void start() {
game.start();
}
When I create the game instance I create a loger: log = Logger.getLogger("TestLog");
(log
is a public field of the class in which the game
belongs).
In the game.start()
I run many processes and give them a reference to the corresponding log
. So, I expect that manager1 and manager2 will write to different files. But manager2 writes to its own file and to the log file of the manager1. Why can it happen?
© Stack Overflow or respective owner