>>          // this proves log4j.properties is in the path
> > System.out.println("Simple: " + log4jfile + " exists: " + l.exists());

No, actually this proves next to nothing. What you've shown is that a file exists in the directory that you started the JVM from. It does not give any indication that the file exists on the classpath in the default package (no package). You would prove that by doing...

URL url = SimpleInit.class.getResource("/log4j.properties");
System.out.println("File exists?: " + (url != null));


Jake

At 03:27 PM 4/2/2006, you wrote:
>Jacob,
>
> Thanks for you help.  Unfortunately your changes did not solve the
>problem. Here is my updated log4j.properties, with your suggestions in place:
>
>
>
> log4j.rootLogger=WARN, SO1
> log4j.logger.tb.test=DEBUG, SO1, RF1
> log4j.logger.org.apache.commons.httpclient.wire=WARN, SO1, RF1
>
>
> # SO1 appender
> log4j.appender.SO1=org.apache.log4j.ConsoleAppender
> log4j.appender.SO1.layout=org.apache.log4j.PatternLayout
> log4j.appender.SO1.layout.ConversionPattern=%d{HH:mm:ss} [%16.16t]
>[%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n
> log4j.appender.SO1.threshold=INFO
>
> #RF1 appender
> log4j.appender.RF1=org.apache.log4j.RollingFileAppender
> log4j.appender.RF1.File=log/test.log
> log4j.appender.RF1.MaxFileSize=10000KB
> log4j.appender.RF1.MaxBackupIndex=9
> log4j.appender.RF1.Append=false
> log4j.appender.RF1.layout=org.apache.log4j.PatternLayout
> #log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p
>[%t] [%X{stbip}] [%C{1} (%L)]: %m%n
> log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss}
>[%16.16t] [%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n
>
>
>
> The output is unchanged:
>      [java] Simple: log4j.properties exists: true
>      [java] log4j:WARN No appenders could be found for logger
>(tb.test.SimpleInit).
>      [java] log4j:WARN Please initialize the log4j system properly.
>
>
> There are no other log4j.properties files anywhere else that might be
> going first in the path.
>
>
> Thanks!
>
>
> -Travis
>
>
>
>Jacob Kjome <[EMAIL PROTECTED]> wrote:
>2 things:
>
>1.  You should *always* define the root logger, such as...
>
>log4j.rootLogger=WARN, SomeAppender
>
>2.  Your other loggers need to be prefixed by "log4j.logger.", such as...
>
>log4j.logger.tb.test=DEBUG, SO1, RF1
>log4j.logger.org.apache.commons.httpclient.wire=WARN, SO1, RF1
>
>
>Jake
>
>At 04:25 AM 4/2/2006, you wrote:
> >Usually putting log4j.properties in the classpath is enough to
> >properly initialize it.  In this case, even though log4j.properties is
> >provably in my classpath, it's not initializing correctly.
> >
> >
> >
> > Here is the code:
> >
> > package tb.test;
> >
> > import org.apache.log4j.Logger;
> > import java.io.File;
> >
> > public class SimpleInit {
> >
> > private static final Logger logger = Logger.getLogger(SimpleInit.class);
> >
> >     public static void main(String[] args) throws Exception {
> >         String log4jfile = "log4j.properties";
> >         File l = new File(log4jfile);
> >
> >         // this proves log4j.properties is in the path
> >         System.out.println("Simple: " + log4jfile + " exists: " +
>l.exists());
> >         //org.apache.log4j.BasicConfigurator.configure();
> >         logger.info("Ahoy");
> >     }
> > }
> >
> >
> >
> > Here is the output:
> > Simple: log4j.properties exists: true
> > log4j:WARN No appenders could be found for logger (tb.test.SimpleInit).
> > log4j:WARN Please initialize the log4j system properly.
> >
> >
> >
> > Here is the log4j.properties:
> >
> > tb.test=DEBUG, SO1, RF1
> > httpclient.wire=WARN, SO1, RF1
> >
> > # SO1 appender
> > log4j.appender.SO1=org.apache.log4j.ConsoleAppender
> > log4j.appender.SO1.layout=org.apache.log4j.PatternLayout
> > log4j.appender.SO1.layout.ConversionPattern=%d{HH:mm:ss} [%16.16t]
> >[%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n
> > log4j.appender.SO1.threshold=INFO
> >
> > #RF1 appender
> > log4j.appender.RF1=org.apache.log4j.RollingFileAppender
> > log4j.appender.RF1.File=log/test.log
> > log4j.appender.RF1.MaxFileSize=10000KB
> > log4j.appender.RF1.MaxBackupIndex=9
> > log4j.appender.RF1.Append=false
> > log4j.appender.RF1.layout=org.apache.log4j.PatternLayout
> > #log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %-5p
> >[%t] [%X{stbip}] [%C{1} (%L)]: %m%n
> > log4j.appender.RF1.layout.ConversionPattern=%d{dd MMM HH:mm:ss}
> >[%16.16t] [%X{stbip}] %-5p [%-6L:%-22.22c{1}] - %m%n
> >
> >
> >
> > Any suggestions appreciated!
> >
> > Thanks!
> >
> >
> > -Travis
> >
> >
> >
> >---------------------------------
> >How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>---------------------------------
>New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.


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

Reply via email to