Sample xml configuration for log4j, have a 'main' java application and want to write to file

前端 未结 3 1873
感情败类
感情败类 2020-12-11 00:40

Are there any example log4j configuration files (XML).

I have a java main application.

I want log4j to output to console AND write to file.

Any examp

3条回答
  •  悲哀的现实
    2020-12-11 01:11

    Here is one sample example of log4j.xml used in Hibernate project.Just need to place this file in classpath and you will get log messages on console as well as in file also.If you want any specific appender you can change in tag.

      
      
      
      
       
        
       
      
          
              
              
      
      
          
          
       
        
      
      
          
              
          
          
              
          
          
              
              
          
      
    

    I found this one more descriptive then above one.Hope it help.

提交回复
热议问题