• 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

New to log4j concept-log messages are not appending to logfile

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,

this is Pradyu and am new to log4j concept.
Am trying to insert log messages to logfile using log4j.properties file in my web project..

in my servlet am using

static Logger logger = Logger.getLogger(New1.class.getName());
PropertyConfigurator.configure("log4j.properties");
logger.debug("dddd");

log4j.properties file ::

og4j.rootLogger=debug,console1,A2
#console1 is console Appender
log4j.appender.console1=org.apache.log4j.ConsoleAppender
log4j.appender.console1.layout=org.apache.log4j.PatternLayout

#file1 is for fileappender
log4j.appender.file1=org.apache.log4j.FileAppender
log4j.appender.file1.File=logfile.log
log4j.appender.file1.Append=true
log4j.appender.file1.layout=org.apache.log4j.PatternLayout
log4j.appender.file1.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n

thanks a lot
pradyu....
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pradyu,

Can you please change your screen name to meet the Javaranch naming policy, thanks!
 
Martijn Verburg
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now onto your question, what is the result you are getting? Is there nothing printing out to the expected place?
 
please buy my thing and then I'll have more money:
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!