• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Need help LOG4j FileAppender Not working

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


When i use Console Appender the logging is working fine . But when i use FileAppnder the output fiel is not generated .
please help .This is my Log4j.properties

# Debug log4j
log4j.debug=true
log4j.rootLogger=debug, myapp

log4j.appender.myapp=org.apache.log4j.FileAppender
log4j.appender.myapp.layout=org.apache.log4j.HTMLLayout
log4j.appender.myapp.layout.LocationInfo=true
log4j.appender.myapp.layout.Title='All' Log
log4j.appender.myapp.File=C/myapp.html
log4j.appender.myapp.ImmediateFlush=true
log4j.appender.myapp.Append=false


Do i need to add anything extra ??Thank you
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:Do i need to add anything extra ??Thank you


That depends. Is this:

C/myapp.html


a valid file name on your system? (On my Windows system I would have to insert a colon to make it valid...)
 
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 .
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had modified the code , but still its not working.

This is my log4j.properties inside my classes folder .



This is inside my servlet :


When i am running the application this is being displayed on to my server console .



log4j:WARN No appenders could be found for logger (TestServlet).
log4j:WARN Please initialize the log4j system properly.


Please help .
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

log4j:WARN Please initialize the log4j system properly.



I just did a google search on that specific message and got a lot of hits, which mention the solution.
 
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 .
It says that i need to put the log4j.properties file inside class path

Does it mean that i put this file in lib folder of the Application / Or on to the common lib of server ??
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:
It says that i need to put the log4j.properties file inside class path


That's correct.

Ravi Kiran V wrote:
Does it mean that i put this file in lib folder of the Application / Or on to the common lib of server ??



Hmm, you never mentioned you are using log4j within some server? Which server are you using?
 
BWA HA HA HA HA HA HA! Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!