log4j log file in user home directory

后端 未结 4 436

I am working on an application that will run on OSX and windows. I want the logs to be written to the users home directory. For OSX it will be under the /Users//Library/Applicat

4条回答
  •  北海茫月
    2021-02-07 16:56

    I have Solved path issue of log4j.xml in mac :

    in windows we configure log4j in web.xml like :

        
            org.springframework.web.util.Log4jConfigListener
        
    
         
            log4jConfigLocation 
            file:${LOG4J_HOME}/conf/log4j.xml 
    
    
         
    
        
            log4jRefreshInterval
            6000
        
    

    Where ${LOG4J_HOME} is user varible we use to set in window. like

    user variable = LOG4J_HOME value = D:/LOG4J (in d drive we have created a folder of name Log4J we copied that path and gave as a value)

    In mac we have envirenvirent variable set fasility by bash command, but it didint work anymore.

    so for mac we have to create one folder any where and we have to give static path of that folder.

    like in xml :

    
            org.springframework.web.util.Log4jConfigListener
        
    
         
            log4jConfigLocation 
            file:/Users/vardhaman/Desktop/LOG4J/conf/log4j.xml 
    
    
         
    
        
            log4jRefreshInterval
            6000
        
    

    Same way we have to do in log4j.xml file

    In window we use to do like :

    
            
            
            
            
            
            
              
            
         
    

    In mac :

    in place of value we have to copy static path up to folder LOG4J, or you can create any folder.

    
            
            
            
            
            
            
              
            
         
    

提交回复
热议问题