File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't able to write errors/exception in file using log4j

 
navneet rajput
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have written log module for generating logs at server side.
Log file created at server side and it is able to write normal logs in to that file, but I have used exception handling and I want to write logs which are throws in my code.
Also I want to write error logs in to that log file.

Please give me some pointers on the same. Any kind of help will be appreciated. Please see the following log4j configuration file for more reference.


########## this is root logger. Logging level set as ERROR ########################

log4j.rootLogger=debug,FILE,stdout
log4j.debug=true

############# This is Appender for writting logs at console #######################

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-4r [%t] %-5p %c %x - %m%n

############ This is appender for writing logs in File ###########################

log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.file=C:\\MyLog_log\\Info.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[%d{MMM dd HH:mm:ss}] %-4r [%t] %-5p %c %x - %m%n

########### This is Appender for defining Max log file size ######################

log4j.appender.MaxFileSize=1000KB

##################################################################################
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What part are you having trouble with?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic