aspose file tools*
The moose likes Other Open Source Projects and the fly likes Writing Log4J for my appliaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Writing Log4J for my appliaction" Watch "Writing Log4J for my appliaction" New topic
Author

Writing Log4J for my appliaction

Ramesh Etta
Ranch Hand

Joined: Sep 18, 2007
Posts: 46
Hi everybody,

I had written a web application for some banking project in Struts. The problem is i have categorized the ActionForm classes into one package, Action classes in one package and so on. Now i have to log the logging information in to two different log files that contains, like in one log file all the creation of accounts information must be logged and in other log file Viewing of balance info, transfer and so on log information and may be all the error information in to one more log file. I want to write the configuration file in an xml file. can any one tell me how this can be possible. ie how we are going to categorize logging information into different log files base on the fucntionality of our application. I feel happy if any one can come with code.

I am using Struts and Log4JLogger.

Thanks in advance.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You can use a naming strategy other than the fully qualified class names to group your logging by whatever you want.

From short introduction to log4j

Log4j makes it easy to name loggers by software component. This can be accomplished by statically instantiating a logger in each class, with the logger name equal to the fully qualified name of the class. This is a useful and straightforward method of defining loggers. As the log output bears the name of the generating logger, this naming strategy makes it easy to identify the origin of a log message. However, this is only one possible, albeit common, strategy for naming loggers. Log4j does not restrict the possible set of loggers. The developer is free to name the loggers as desired.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing Log4J for my appliaction
 
Similar Threads
log4j : stopping lower level package logging
Log4J - Different Log files for different parts of app
Customize Logger Problem
Log4J Query
Logging Package Specific logs using LOG4J