You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Staffan Vilcans <st...@jadestone.se> on 2005/04/08 15:40:50 UTC

Configuring log4cxx using XML

1) It seems there is very little documentation on how to configure the 
behaviour of log4cxx using configuration files. I had to guess a lot and 
look on log4j for clues (and that documentation is just as bad). Anyway, 
now I think I have a working file.

2) If I understand correctly as described under "Default Initialization 
Procedure" what happens is first it checks for the enviroment variables 
LOG4CXX_CONFIGURATION and if that doesn't exist it looks for 
log4j.configuration and if that also fails it looks for the files 
log4cxx.properties, log4j.properties, log4cxx.xml and log4j.xml in the 
current working directory. Ok, I have a file called log4cxx.xml and on 
upstart I get
No appenders could be found for logger (root).
Please initialize the log4cxx system properly.

I have tried to enter errors into the file and rename if to see if it's 
being read, but it seems like it's ignored. Do I really need to use 
DOMConfigurator::configure() ?
I'm running under Fedora 3.

-- 
Cell: +46 737 282 486
Phone: +46 8 442 75 94 (ext 242)
Fax: +46 8 24 05 08
www.jadestone.se
Björns Trädgårdsgränd 1, 116 21 Stockholm, Sweden


Re: Configuring log4cxx using XML

Posted by Staffan Vilcans <st...@jadestone.se>.
Curt Arnold wrote:

> The goal is for log4cxx to be compatible with log4j configuration 
> files and need minimal independent documentation.  I'm sure log4j 
> documentation could always use improvement.

Indeed. How to configure using XML files is less than obvious.

> You did not mention what version of log4cxx you are using.  
> LOG4CXX_CONFIGURATION, log4cxx.xml and log4cxx.properties are only 
> checked by the CVS HEAD (the forthcoming log4cxx 0.9.8).  If you are 
> using log4cxx 0.9.7, only LOG4J_CONFIGURATION, log4j.xml and 
> log4j.properties are checked.

Ah, ofcourse! I'm using 0.9.7. That explains it.

-- 
Cell: +46 737 282 486
Phone: +46 8 442 75 94 (ext 242)
Fax: +46 8 24 05 08
www.jadestone.se
Björns Trädgårdsgränd 1, 116 21 Stockholm, Sweden


Re: Configuring log4cxx using XML

Posted by Curt Arnold <ca...@apache.org>.
The goal is for log4cxx to be compatible with log4j configuration files 
and need minimal independent documentation.  I'm sure log4j 
documentation could always use improvement.

You did not mention what version of log4cxx you are using.  
LOG4CXX_CONFIGURATION, log4cxx.xml and log4cxx.properties are only 
checked by the CVS HEAD (the forthcoming log4cxx 0.9.8).  If you are 
using log4cxx 0.9.7, only LOG4J_CONFIGURATION, log4j.xml and 
log4j.properties are checked.

Several unit tests check default configuration behavior, so it is 
functional.


On Apr 8, 2005, at 8:40 AM, Staffan Vilcans wrote:

> 1) It seems there is very little documentation on how to configure the 
> behaviour of log4cxx using configuration files. I had to guess a lot 
> and look on log4j for clues (and that documentation is just as bad). 
> Anyway, now I think I have a working file.
>
> 2) If I understand correctly as described under "Default 
> Initialization Procedure" what happens is first it checks for the 
> enviroment variables LOG4CXX_CONFIGURATION and if that doesn't exist 
> it looks for log4j.configuration and if that also fails it looks for 
> the files log4cxx.properties, log4j.properties, log4cxx.xml and 
> log4j.xml in the current working directory. Ok, I have a file called 
> log4cxx.xml and on upstart I get
> No appenders could be found for logger (root).
> Please initialize the log4cxx system properly.
>
> I have tried to enter errors into the file and rename if to see if 
> it's being read, but it seems like it's ignored. Do I really need to 
> use DOMConfigurator::configure() ?
> I'm running under Fedora 3.