Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j error?

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my class



here is my property file
[code]
log4j.rootLogger=DEBUG, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
[code]

here is the error
http://4.bp.blogspot.com/_bpkZ2BsqXug/S2qR72PMRDI/AAAAAAAAAFU/LUDjbIL25kU/s1600-h/log.GIF

i have already added log4j.jar file too
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have already added log4j.jar file too


But you are importing java.util.logging.*

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i change class


now i got this error when i run project

 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As shown in the exception stacktrace, the:



isn't able to find that file. Did you try specifying an absolute path of the log4j.properties?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to give absolute path?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:how to give absolute path?


From here

An absolute pathname is complete in that no other information is required in order to locate the file that it denotes


So where exactly on your filesystem does that log4j.properties file exist. You will have to specify that entire path in the code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic