You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by deepak singh <de...@gmail.com> on 2009/05/24 22:14:03 UTC
Issue with PropertyConfigurator::configure function
Hi,
I am using property file to configure the log4cxx. I am not able to check
the correctness of the input property file.
I tried the try, catch but PropertyConfigurator::configure function is not
throwing any exception.
I passed the dummy property file and in this case configure file printing
following messages on the console :
log4cxx: No appender could be found for logger (root).
log4cxx: Please initialize the log4cxx system properly.
Please let me know how to catch this error?
-------------------Code-----------------
void InitLog(const char *file)
{
log4cxx::PropertyConfigurator::configure(log4cxx::File(file));
}
Re: Issue with PropertyConfigurator::configure function
Posted by deepak singh <de...@gmail.com>.
hi Curt,
Thanks for the mail.
In My code, I wanted to check for incorrect configuration file.
Is there any way to know that if
log4cxx::PropertyConfigurator::configure(log4cxx::File(file));
does not succeed. (apart form getting error message to the cosole). Doe it
provide anything which we can handle programatically if function returns
error?
-------------------Code-----------------
void InitLog(const char *file)
{
log4cxx::PropertyConfigurator::configure(log4cxx::File(file));
}
----------
On Mon, May 25, 2009 at 6:50 PM, Curt Arnold <ca...@apache.org> wrote:
> log4cxx follows the pattern set by log4j which is to silently swallow any
> configuration errors. Add a log4j.debug=true to your property file and you
> may get some diagnostic output to the console. Otherwise, post your
> configuration file here and we can help.
>
>
>
> On May 24, 2009, at 3:14 PM, deepak singh wrote:
>
> Hi,
>> I am using property file to configure the log4cxx. I am not able to check
>> the correctness of the input property file.
>> I tried the try, catch but PropertyConfigurator::configure function is
>> not throwing any exception.
>> I passed the dummy property file and in this case configure file printing
>> following messages on the console :
>>
>> log4cxx: No appender could be found for logger (root).
>> log4cxx: Please initialize the log4cxx system properly.
>>
>>
>> Please let me know how to catch this error?
>> -------------------Code-----------------
>> void InitLog(const char *file)
>> {
>> log4cxx::PropertyConfigurator::configure(log4cxx::File(file));
>> }
>>
>
>
Re: Issue with PropertyConfigurator::configure function
Posted by Curt Arnold <ca...@apache.org>.
log4cxx follows the pattern set by log4j which is to silently swallow
any configuration errors. Add a log4j.debug=true to your property
file and you may get some diagnostic output to the console.
Otherwise, post your configuration file here and we can help.
On May 24, 2009, at 3:14 PM, deepak singh wrote:
> Hi,
> I am using property file to configure the log4cxx. I am not able to
> check the correctness of the input property file.
> I tried the try, catch but PropertyConfigurator::configure function
> is not throwing any exception.
> I passed the dummy property file and in this case configure file
> printing following messages on the console :
>
> log4cxx: No appender could be found for logger (root).
> log4cxx: Please initialize the log4cxx system properly.
>
>
> Please let me know how to catch this error?
> -------------------Code-----------------
> void InitLog(const char *file)
> {
> log4cxx::PropertyConfigurator::configure(log4cxx::File(file));
> }