logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gulcu <...@urbanet.ch>
Subject Re: Trying to figure out how to get Log4J to work with Properties
Date Fri, 29 Dec 2000 18:39:42 GMT
Alex,

When you call the PropertyConfigurator.configure() the argument must match 
the name of the file.
So, the call should 
be  PropertyConfigurator.configure("LogSetting.properties");

Hope this helps, Ceki

ps: To see what log4j is doing, define the system property 
log4j.configDebug as in

    java -Dlog4j.configDebug your.application

At 06:48 29.12.2000 -0800, Alex Colic wrote:
>Hi,
>
>I am trying to figure out how to get Log4J to work with a properties file 
>which I have created and
>I am having a bit of a problem. I think I have done everything correctly 
>but Log4J can't find my
>properties file. I have created a class called Test with the following 
>code in the Main:
>
>   PropertyConfigurator.configure("LogSetting");
>   Category cat=Category.getInstance("test");
>   cat.info("Info Entry");
>   cat.warn("Warn entry");
>   cat.error("Error entry");
>   cat.debug("Debug entry");
>
>I have also created a properties file called "LogSetting.properties" and 
>placed it with the test
>class file. I have checked and this is on my class path. The properties 
>file consists of:
>
>log4j.configDebug=true
>log4j.appender.A1=org.log4j.FileAppender
>log4j.appender.A1.File=System.out
>
>log4j.rootCategory=DEBUG, A1
>
>log4j.appender.A1.layout=org.log4j.PatternLayout
>log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x-%m%n
>
>
>When I run my test program I get the following error:
>
>
>log4j: Could not read configuration file [LogSetting].
>java.io.FileNotFoundException: LogSetting (The system cannot find the file 
>specified)
>
>Any ideas or help in getting this to work will be greatly appreciated.
>
>Alex
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Photos - Share your holiday photos online!
>http://photos.yahoo.com/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message