I have 2 logging files. I have defined two appenders for the 2 files. In a class, if i need to output few logs to one file, and few to the other, do i need to have 2 logger instances. Is there a cleaner way of achieving this requirement? Or is there some log4j configuration that will help me?
You do not really provide a lot of information about what is different about the log messages that they would be directed to different log files.
It would certainly work to create two loggers and log to the one with the appender you want the message to be directed to. Sounds simple unless your logic in your class would then be complicated.
If you use XML to configure your log4j instead of properties, appenders may have filters applied to them. See the Filter API, it lists the existing filters DenyAllFilter, LevelMatchFilter, LevelRangeFilter, and StringMatchFilter. It describes how filters work at a high level and indicates you may extend the filter class to create a custom filter.