commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <Ste...@ignitesports.com>
Subject RE: xml configuration question
Date Thu, 02 May 2002 19:56:44 GMT
Actually, my config file was NOT correct.  See below.

However, thanks for all your help.  The first suggestion that helped was Mark's suggestion
to define debugging in the JVM command line.  This brought out some new
information:

log4j:WARN File option not set for appender [applog].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?

Huh?  Oh, yeah, that brought me around to Ceki's question.

>I suppose you are calling 
>DOMConfigurator.configure("SOME_PATH/log4jcfg.xml") somewhere
>in your code. Right?

Doh!  I wasn't.  I was following the suggestion in the manual to create a separate initialization
servlet and was blindly pasting code.  Right, that's a PropertyConfigurator you're using in
there.  Rewriting that code solved THAT problem:

    // if the log4j-init-file is not set, then no point in trying
    if(file != null) {
      if (file.toLowerCase().endsWith(".xml")) {
          DOMConfigurator.configure(prefix+file);
      } else {                                      
          PropertyConfigurator.configure(prefix+file);
      }
    }
I thought I'd read somewhere that some part of the system was already reacting to the file
name to decide which configurator to use, but evidently that somewhere was not here.  Oh well.

That got me halfway there, but then there was this:

log4j:WARN No such property [file] in org.apache.log4j.PatternLayout.
log4j:WARN No such property [datePattern] in org.apache.log4j.PatternLayout.

File and DatePattern are members of Appender, not of PatternLayout.
Anyway, that got me off the dime and working.

I guess it had nothing to do with commons-logging.

Again, thanks for all the help.

-----------------------------------------------------------------
Steve Cohen
Sr. Software Engineer
Ignite Sports, Inc.
stevec@ignitesports.com


-----Original Message-----
From: Ceki Gülcü [mailto:ceki@qos.ch]
Sent: Thursday, May 02, 2002 2:31 PM
To: Log4J Users List
Subject: Re: xml configuration question



Robert,

Steve's config file is correct. He attaches an appender to the root logger 
which
will be inherited by other loggers.

Your suggestion where you attach an appender directly to
"com.ignitesports.autopublish" is misleading.

At 13:52 02.05.2002 -0500, you wrote:

>Steve,
>
>I think I've come across the same thing with my program.   If you add the
>following to your
>xml file, you shouldn't get the error message any more.
>
>     <category name="com.ignitesports.autopublish">
>        <priority value="debug" />
>        <appender-ref ref="appender" />
>     </category>
>
>Let me know if this works or not.
>
>HTH,
>Robert Lasch
>Follett Corporation
>
>
>
>
> 
>
>                     "Steve 
> Cohen" 
>
>                     <SteveC@ignites        To:     "Log4J Users List" 
> <log4j-user@jakarta.apache.org>
>                     ports.com>             cc: 
>
>                                            Subject:     xml configuration 
> question
>                     05/02/2002 
>
>                     01:26 
> PM 
>
>                     Please 
> respond 
>
>                     to "Log4J 
> Users 
>
>                     List" 
>
> 
>
> 
>
>
>
>
>
>Probably dumb, but I can't figure it out.
>
>Here's my configuration:
>
><?xml version="1.0" encoding="UTF-8" ?>
><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
><log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" >
>    <appender name="applog" class
>="org.apache.log4j.DailyRollingFileAppender">
>       <layout class="org.apache.log4j.PatternLayout">
>         <param name="ConversionPattern" value="%d{DATE} %p %t %c - %m%n"/>
>         <param name="File" value="AutoPublish.log" />
>         <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"/>
>       </layout>
>    </appender>
>    <root>
>       <priority value="debug"/>
>       <appender-ref ref="applog" />
>    </root>
></log4j:configuration>
>
>This is stored in a file named log4jcfg.xml.
>
>When I attempt to log against this, I get the following error messages:
>
>log4j:WARN No appenders could be found for logger
>(com.ignitesports.autopublish).
>log4j:WARN Please initialize the log4j system properly.
>
>The fact that I am getting log4j errors indicates to me that there are no
>more issues about finding classes needed and that logging has been
>initialized.
>
>The troubleshooting guide says this about this error:
>
>Log4j does not have a default logging target.  It is the user's
>responsibility to ensure that all categories can inherit an appender. This
>can be easily achieved by attaching an appender to the root category.
>
>Haven't I attached the "applog" appender to the root in the above config
>script?
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
Ceki


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


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message