On Saturday 29 August 2009 21:01:37 deepak singh wrote:
> The reason could be you are initializing the logger multiple times.
> Can you send the code where you are initializing the logger and make sure
> that part of code is called just once during entire execution.
> Thanks
> Deepak
>
Thanks for the quick reply.
The only init parts are these:
Controller::Controller() {
//initialize logger
//TODO move outside the constructor
logger = log4cxx::Logger::getLogger("Controller");
BasicConfigurator::configure();
logger->setLevel(log4cxx::Level::getTrace());
//listen for messages
// ListenSignals();
}
Watcher::Watcher(string node_name, int jvm_pid, int tick) {
//initialize logger
//TODO move outside the constructor
logger = log4cxx::Logger::getLogger("Watcher " + node_name);
BasicConfigurator::configure();
logger->setLevel(log4cxx::Level::getDebug());
}
DBusMessaging::DBusMessaging(string connection_name){
//initialize logger
//TODO move outside the constructor
logger = log4cxx::Logger::getLogger("DBus Messaging singleton " );
BasicConfigurator::configure();
logger->setLevel(log4cxx::Level::getDebug());
}
etc
Vasile
> On Sat, Aug 29, 2009 at 10:57 PM, <[email protected]> wrote:
> > Hello,
> >
> > I am using a simple configuration:
> >
> > DBusMessaging::DBusMessaging(string connection_name){
> > //initialize logger
> > //TODO move outside the constructor
> > logger = log4cxx::Logger::getLogger("DBus Messaging singleton " );
> > BasicConfigurator::configure();
> > ....
> >
> > and the logging output is being duplicated like this:
> >
> >
> > 0 [0xb7f37700] DEBUG DBus Messaging singleton null - Connecting to
> > DBUS... 0 [0xb7f37700] DEBUG DBus Messaging singleton null - Connecting
> > to DBUS... 6 [0xb7f37700] DEBUG DBus Messaging singleton null -
> > Connected with name to D-BUS with pa.controller
> > 6 [0xb7f37700] DEBUG DBus Messaging singleton null - Connected with name
> > to D-BUS with pa.controller
> >
> >
> > This happens with every class that I am using log4cxx with (for some I
> > get 4 lines of output). Is this normal behaviour
> > or am I doing something wrong ?
> >
> > Thanks,
> > Vasile