#238 How to check if configuration has been run?

future
open
None
5
2014-09-19
2013-03-24
Ken
No

How can I check whether or not log4cplus has been configured?

That is, if I run a class which has some LOG4CPLUS_DEBUG(logger,...) code, how can I check if the configuration has been previously run or not so as to avoid:

log4cplus:ERROR No appenders could be found for logger ([loggername]).
log4cplus:ERROR Please initialize the log4cplus system properly.

Thanks.

Discussion

  • There is no specific check that any configuration has been done. But you can ask if certain logger does or does not exist. See log4cplus::Logger::exists().

     
    • assigned_to: Václav Zeman
     
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,10 @@
     How can I check whether or not log4cplus has been configured?
    
    -That is, if I run a class which has some LOG4CPLUS_DEBUG(logger,...) code, how can I check if the configuration has been previously run or not so as to avoid:
    +That is, if I run a class which has some `LOG4CPLUS_DEBUG(logger,...)` code, how can I check if the configuration has been previously run or not so as to avoid:
    +
    +~~~~
     log4cplus:ERROR No appenders could be found for logger ([loggername]).
     log4cplus:ERROR Please initialize the log4cplus system properly.
    +~~~~
    
     Thanks.
    
     
  • Ticket moved from /p/log4cplus/support-requests/38/

     
    • Group: beta --> future