Reputation: 495
I want to log some values for each object of my program into a flat file or csv file. I was thinking of creating separate folders for each of these Objects and storing their log files in their respective folders. Is this possible ? If yes, then is it advisable ?
As an aside, I was thinking of using some logging API. But, I don't know when it is appropriate to use a logging API. Any advice on that also ?
Upvotes: 0
Views: 1306
Reputation: 8229
I could suggest you log4j library for logging. It's easy to archive your issue using it.
Try to declare separate appender for each class:
FileAppender appender = new FileAppender();
// configure the appender here, with file location, etc
appender.activateOptions();
Logger logger = getRootLogger();
logger.addAppender(appender);
Upvotes: 1