Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i add Log4j suppourt to my Application

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

How Can i add Log4j to my suppourt ??

A site says this thing :


Once you have added the log4j JAR file to your application, then you will need to setup log4j using either a log4j.properties or log4j.xml file.



I have a web application . i have added a log4j jar to my Application . Please tell me how can i add Log4j suppourt to my Application ??
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am using Log4j inside my class like this :



This is my properties file :


But this prints log statements in my IDE console only.

I want to have all these statements inside a File . Please tell me how can i do all these ??
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi Kiran V wrote:I want to have all these statements inside a File.

Sorry, which "statements" do you want to have inside a file? Your configuration will already be in a file, so it isn't clear what you mean by that sentence.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which "statements" do you want to have inside a file?



Inside my java class


My query is How can i have all these above statements inside a File (Rather than on to console).

Please tell me .
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. You really mean "How can I get the logging output from these statements into a file", right? You don't want the Java statements to be in a file, do you?

You will find programming is easier if you express yourself clearly. If you can't express what you want to do, you won't be able to write a program to do that.

But anyway, back to the question. Your properties file specifies a ConsoleAppender and nothing else. That's why the logging output goes to the console and nowhere else. If you want it to go to a file then you need to specify a FileAppender in the properties file.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you paul .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic