I am using log4j for logging. I have a scenario where I have to use seperate logging for different severity. For example, for package foo I have to print messages with severity ERROR in the console whereas I have to print messages with severity WARN in log file. How can I configure my log4j.xml for the same.
Share
You may use LevelMatchFilter for your task. Also you should not forget to use another filter – DenyAllFilter – as the last filter in the chain of filters.
Your log4j.xml will look like this: