Using Log4J 1.*, how can I write two packages to two separate files?

前端 未结 4 1570
终归单人心
终归单人心 2020-12-31 11:11

I have the following two packages:

com.mycorp.project.first
com.mycorp.project.second

I\'d like to configure Log4J (SLF4J) to write the logs from one pac

4条回答
  •  醉酒成梦
    2020-12-31 11:21

    Create two appenders LOG1 and LOG2, one for each log file. After that define two categories(one for each package) with reference to these appenders int the log4j config file.

    
        
        
    
    

    Appender2

    
        
        
    
    


提交回复
热议问题