I am looking at log4j for use as a logging subsystem and have read the available docs. However, I want to use it to define multiple loggers - so that I can send different kinds of messages to different log files (DEBUG to a debug.log, INFO to an info.log, etc) from the same application. Another use would be to separate log files in a particular application by subject area - so database-related logging goes to a db.log, jndi-related logging to a jndi.log, etc. Can anyone tell me whether this kind of functionality is already built into log4j ? I can write a related set of classes to do this for me but want to avoid re-inventing it if it's already a feature.
Great idea...although I'm not sure I know how to do it. I love log4j, I just wish there was a little more documentation. I've included a log config that I use, which writes all output to both the console and a log file. Maybe you can use this to get started. I would really like to see your solution on this. log4j.rootLogger=info, logfile, console
Although this question was asked a while ago, I came across it when doing some searches and figured others might also, so I thought I'd post this reply... See Sorting Log Messages By Levelat the Apache website for info on how to do this.
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop