• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can some one say what is wrong with my log4j.properties?

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post.
I have a log4j.properties which does not function correctly.
i want all log messages to go to a file like: messages.log but it append them to console instead of FileAppender.

here is the log4j properties file:



thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try removing the line
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Other than getting a warning, your log4j.properties file worked for me. It wrote to messages.log in the directory I was running the java command from. I am using version 1.2.14.

log4j:WARN No such property [target] in org.apache.log4j.FileAppender.



Is it really using the properties file you think it is?

Try adding log4j.debug=true to the properties file or a system property to the java call (it will put out some internal debug info to the console including how it is getting configured):

-Dlog4j.debug

[edited to add version number]
[ January 08, 2007: Message edited by: Carol Enderlin ]
 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for reply.
It is fixed now, but another problem that i faces is like this:
The logger log hibernate messages but not my own message.
here is the code portion that i used to log some messges to this log file.
but my own messages are not in the log file and nor in the console

here is my code portion:


why it does not add my own messages to log file?

thanks
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your root logger (so rootlogger and everything else that isn't specified) is set to WARN level so debug and info won't be included
[ January 08, 2007: Message edited by: Carol Enderlin ]
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic