Write a servlet:
Package colorling;
Import javax.servlet. *; import javax.servlet.http. *; import java.io. *; import com.soutec.g_log.config;
Public class initlog extends httpservlet {
Public void init () throws servletexception {// log: string path = system.getProperty ("user.dir"); //system.out.println (PATH); config.staticinit (Path File.seParetor "log4j. Properties "); // Initialize the log module
System.out.println ("Initial Log Finish!");}}
Do the initialization work you want to implement in the init () method. In this example, it is the initialization of the log module.
Then add: initlog servlet-name> colorring.initlog Servlet-Class> 1 load-on-startup> Restart the server, you will see that the initialization work has been completed.