Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
pradyu.kunchala
Greenhorn
Posts: 1
  • 0
  • 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....
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • 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
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • 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?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic