Java – how to configure my log4j (using GlassFish) login log directory instead of configuration?
•
Java
My log4j The properties file has the following line:
log4j. appender. logfile. File = MyApplication. log
My log file appears in the mydomain / config directory, but I want it to log in to the mydomain / logs directory How can I achieve it? I am not allowed to modify the startserv script
Thank you for your help!
Solution
In fact, it is log4j, which parses the variable ${Catalina. Home}. GlassFish declares ${Catalina. Home} as ${com. Sun. AAS. Instanceroot}, which points to / mydomain/
You can declare any variable in the GF environment and put it in log4j When log4j is configured on properties, log4j will parse them
This is useful for setting server based logging configuration parameters, using the same log4 Properties for testing and deployment
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
