You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Sanjay Gupta (sanjaygu)" <sa...@cisco.com> on 2003/04/28 19:14:16 UTC

properties file in xml

I am trying to use proerties file in XML format. How do I make my
program read that file.
 
For log4j.properties in proerties format, if I place the
log4j.properties in the classpath, the program picks it up
automatically.
However, the same does not work if my file is in xml format. How do I do
that?
 
-Sanjay

RE: properties file in xml

Posted by "Sanjay Gupta (sanjaygu)" <sa...@cisco.com>.
I am using log4j1.2.8. I have log4j.xml in my classpath. I get the error
-

log4j:WARN No appenders could be found for logger (BRLOG).
log4j:WARN Please initialize the log4j system properly.

-Sanjay

---------------------log4j.xml-----------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
        <appender name="RBLOG"
class="org.apache.log4j.RollingFileAppender">
           <appender-ref ref="TEMP" />
           <param name="File"
value="/apps/NSAx/httpd/tomcat/webapps/broker-dev/logs/br.log" />
           <param name="Threshold" value="ERROR" />
           <param name="MaxFileSize" value="10240KB" />
           <param name="MaxBackupIndex" value="10" />
           <layout class="org.apache.log4j.PatternLayout">
              <param name="ConversionPattern" value="%p [%d{dd MMM
HH:mm:ss}] - %m%n />
           </layout/>
        </appender>

        <appender name="STDOUT"
class="org.apache.log4j.ConsoleAppender">
            <layout class="org.apache.log4j.PatternLayout">
              <param name="ConversionPattern" value="%p [%d{dd MMM
HH:mm:ss}] - %m%n />
           </layout>
        </appender>

        <category name="BRLOG">
           <priority value="debug"/>
           <appender-ref ref="RBLOG" />
        </category>
        <root>
           <priority value ="debug" />
           <appender-ref ref="STDOUT" />
        </root>
</log4j:configuration>
--------------------Sample Code-----------------------

public class Log4jTest
{
  protected static Category log = Category.getInstance("BRLOG");

  public static void main(String[] args)
  {
    Log4jTest.log.debug("DEBUG");
    Log4jTest.log.info("INFO");
    Log4jTest.log.warn("WARNING");
    Log4jTest.log.error("ERROR");
    Log4jTest.log.fatal("FATAL");
  }
}

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Monday, April 28, 2003 10:24 AM
To: Log4J Users List
Subject: Re: properties file in xml



Are you using Log4j-1.2.8 and have your file named "log4j.xml"?  If not,
do 
that and see if the problem goes away.

Jake

At 10:14 AM 4/28/2003 -0700, you wrote:
>I am trying to use proerties file in XML format. How do I make my 
>program read that file.
>
>For log4j.properties in proerties format, if I place the 
>log4j.properties in the classpath, the program picks it up 
>automatically. However, the same does not work if my file is in xml 
>format. How do I do that?
>
>-Sanjay


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: properties file in xml

Posted by Jacob Kjome <ho...@visi.com>.
Are you using Log4j-1.2.8 and have your file named "log4j.xml"?  If not, do 
that and see if the problem goes away.

Jake

At 10:14 AM 4/28/2003 -0700, you wrote:
>I am trying to use proerties file in XML format. How do I make my
>program read that file.
>
>For log4j.properties in proerties format, if I place the
>log4j.properties in the classpath, the program picks it up
>automatically.
>However, the same does not work if my file is in xml format. How do I do
>that?
>
>-Sanjay