Thanks for your reply.

> The example is simple enough.
> I suggest you try it again replacing configDebug="true" with 
> debug="true"
> 
> 
> ><?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE 
> log4j:configuration 
> >SYSTEM "log4j.dtd">
> >
> ><log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
> >                      configDebug="true">

I made the change you suggested with no changes in symptoms.

As I had seen a deprecation warning involving DOMConfigurator, I tried
changing the test program to use the JoranConfigurator; again there were no
changes in symptoms.

The test program is now:

/*
 * Copyright 1999,2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package trivial;

import org.apache.log4j.joran.JoranConfigurator;
import org.apache.log4j.Category;
import org.apache.log4j.NDC;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;


/**
   View the <a href="doc-files/Trivial.java">source code</a> of this a
   trivial usage example. Running <code>java examples.Trivial</code>
   should output something similar to:

   <pre>
      0    INFO  [main] examples.Trivial (Client #45890) - Awake awake. Put
on thy strength.
      15   DEBUG [main] examples.Trivial (Client #45890 DB) - Now king David
was old.
      278  INFO  [main] examples.Trivial$InnerTrivial (Client #45890) -
Entered foo.
      293  INFO  [main] examples.Trivial (Client #45890) - Exiting Trivial.
   </pre>

   <p> The increasing numbers at the beginning of each line are the
   times elapsed since the start of the program. The string between
   the parentheses is the nested diagnostic context.

   <p>See [EMAIL PROTECTED] Sort} and [EMAIL PROTECTED] SortAlgo} for sligtly more 
elaborate
   examples.

   <p>Note thent class files for the example code is not included in
   any of the distributed log4j jar files. You will have to add the
   directory <code>/dir-where-you-unpacked-log4j/classes</code> to
   your classpath before trying out the examples.

 */
public class Trivial {
    static Logger cat = Logger.getLogger(Trivial.class.getName());


  public static void main(String[] args) {
    JoranConfigurator jc = new JoranConfigurator();
 
jc.doConfigure("C:\\temp\\chainsaw2\\logging-log4j\\examples\\src\\trivial\\
log4jconfig.xml", LogManager.getLoggerRepository());
    jc.logErrors();
    NDC.push("Client #45890");

    cat.info("Awake awake. Put on thy strength.");
    Trivial.foo();
    InnerTrivial.foo();
    cat.info("Exiting Trivial.");
  }

  static void foo() {
    NDC.push("DB");
    cat.debug("Now king David was old.");
    NDC.pop();
  }

  static class InnerTrivial {
      static Logger cat = Logger.getLogger(InnerTrivial.class.getName());

    static void foo() {
      cat.info("Entered foo.");
    }
  }
}

The log4jconfig.xml file now looks like:

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

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
                     debug="true">

        <appender name="R" class="org.apache.log4j.RollingFileAppender">
                <param name="MaxFileSize" value="100KB" />
                <param name="Append" value="true" />
                <param name="File"   value="c:/temp/routetext.log" />
                <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern"
                           value="%-5p %c{2} - %m\n"/>
                </layout>

        </appender>
    
        <appender name="TEMP" class="org.apache.log4j.ConsoleAppender">
                <param name="Append" value="false" />
                <layout class="org.apache.log4j.PatternLayout">
                    <param name="ConversionPattern"
                           value="%-5p %c{2} - %m\n"/>
                </layout>


        </appender>
 
        <root>
          <appender-ref ref="R" />             
          <appender-ref ref="TEMP" />          
        </root>
</log4j:configuration>

Any ideas?

Thanks.

Mike Blake-Knox
email: [EMAIL PROTECTED]
TSYS Office: (706) 644-3643
cellphone: (706) 570-4641
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to