Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j, How to create a logger?

 
M Jay
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to use log4j to log activity within my web application, I've had a look at the tutorial at Apache's website but was not much helpful.

Basically I want to create 3 types of loggers:

1- Debug Logger (to log debug related stuff)
2- Error Logger (to log errors)
3- Performance Logger (to log performance related stuff)

How do I go about this?
Do I subclass the Logger class for each one of those?
And then how do I specify to which file each one logs?

If anyone can help me or direct me to a useful resource I would be grateful.

Thanks
 
M Jay
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I specify the log file's name to be a dynamic name, for example if it's a daily rolling logger than I want the name of the file to have the date?
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought the The complete log4j manual (in PDF format) was an excellent tutorial.
It's not free, but was written by log4j developer.

I didn't use the complete manual to get started with log4j, we just used the Short Introduction to log4j.

If those don't meet your needs, I'd suggest google to find some instructions that make more sense to you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic